summaryrefslogtreecommitdiffstats
path: root/pyload/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/web/app')
-rw-r--r--pyload/web/app/index.html47
-rw-r--r--pyload/web/app/scripts/models/Setup.js20
-rw-r--r--pyload/web/app/scripts/views/linkgrabber/packageView.js12
-rw-r--r--pyload/web/app/scripts/views/setup/finishedView.js25
-rw-r--r--pyload/web/app/scripts/views/setup/setupView.js52
-rw-r--r--pyload/web/app/scripts/views/setup/systemView.js5
-rw-r--r--pyload/web/app/scripts/views/setup/userView.js39
-rw-r--r--pyload/web/app/scripts/views/setup/welcomeView.js5
-rw-r--r--pyload/web/app/styles/default/main.less4
-rw-r--r--pyload/web/app/styles/default/setup.less0
-rw-r--r--pyload/web/app/styles/default/style.less13
-rw-r--r--pyload/web/app/templates/default/setup/error.html14
-rw-r--r--pyload/web/app/templates/default/setup/finished.html23
-rw-r--r--pyload/web/app/templates/default/setup/layout.html5
-rw-r--r--pyload/web/app/templates/default/setup/system.html57
-rw-r--r--pyload/web/app/templates/default/setup/user.html34
-rw-r--r--pyload/web/app/templates/default/setup/welcome.html24
17 files changed, 325 insertions, 54 deletions
diff --git a/pyload/web/app/index.html b/pyload/web/app/index.html
index bf75d40ed..98e1bf233 100644
--- a/pyload/web/app/index.html
+++ b/pyload/web/app/index.html
@@ -80,29 +80,52 @@
<a href="http://pyload.org/" target="_blank">The pyLoad Team</a><br>
</div>
</div>
- <div class="span2">
- <h2 class="block-title">Powered by</h2>
+ <div class="span2 block">
+ <h2 class="block-title">
+ <a href="http://pyload.org" target="_blank">
+ Community &nbsp;<i class="icon-comment"></i>
+ </a>
+ </h2>
<hr>
- Bootstrap <br>
+ <a href="http://pyload.org" target="_blank">Homepage</a>&nbsp;&middot;
+ <a href="http://board.pyload.org" target="_blank">Board</a>&nbsp;&middot;
+ <a href="http://pyload.org/chat" target="_blank">Chat</a>
</div>
- <div class="span2">
- <h2 class="block-title">pyLoad</h2>
+ <div class="span2 block">
+ <h2 class="block-title">
+ <a href="https://twitter.com/pyload" target="_blank">
+ Follow us &nbsp;<i class="icon-twitter"></i>
+ </a>
+ </h2>
<hr>
- dsfdsf <br>
+ <a href="https://twitter.com/pyload" target="_blank">Twitter</a>&nbsp;&middot;
+ <a href="http://www.youtube.com/user/pyloadTeam" target="_blank">Youtube</a>
</div>
- <div class="span2">
- <h2 class="block-title">Community</h2>
+ <div class="span2 block">
+ <h2 class="block-title">
+ <a href="https://github.com/pyload" target="_blank">
+ Development &nbsp;<i class="icon-github"></i>
+ </a>
+ </h2>
<hr>
- asd <br>
+ <a href="https://github.com/pyload" target="_blank">Github</a>&nbsp;&middot;
+ <a href="http://docs.pyload.org" target="_blank">Documentation</a>
</div>
- <div class="span2">
- <h2 class="block-title">Development</h2>
+ <div class="span2 block">
+ <h2 class="block-title">
+ <a href="http://pyload.org/donate" target="_blank">
+ Donate &nbsp;<i class="icon-bitcoin">&nbsp;</i>
+ </a>
+ </h2>
<hr>
- asd <br>
+ <a href="http://pyload.org/donate" target="_blank">PayPal</a>&nbsp;&middot;
+ <a href="http://blockchain.info/address/1JvcfSKuzk3VENJm9XtqGp2DCTesgokkG2" target="_blank">Bitcoin</a>&nbsp;&middot;
+ <a href="https://flattr.com/profile/pyload" target="_blank">Flattr</a>
</div>
+
</div>
</div>
</footer>
diff --git a/pyload/web/app/scripts/models/Setup.js b/pyload/web/app/scripts/models/Setup.js
index 82a2978db..424edf452 100644
--- a/pyload/web/app/scripts/models/Setup.js
+++ b/pyload/web/app/scripts/models/Setup.js
@@ -4,10 +4,30 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'],
return Backbone.Model.extend({
+ url: App.apiUrl('setup'),
defaults: {
lang: 'en',
+ system: null,
+ deps: null,
user: null,
password: null
+ },
+
+ fetch: function(options) {
+ options || (options = {});
+ options.url = App.apiUrl('setup');
+ return Backbone.Model.prototype.fetch.call(this, options);
+ },
+
+ // will get a 409 on success
+ submit: function(options) {
+ options || (options = {});
+ options.url = App.apiUrl('setup_done');
+ options.data = {
+ user: this.get('user'),
+ password: this.get('password')
+ };
+ return Backbone.Model.prototype.fetch.call(this, options);
}
});
diff --git a/pyload/web/app/scripts/views/linkgrabber/packageView.js b/pyload/web/app/scripts/views/linkgrabber/packageView.js
index 95c46e3cc..356d39b4b 100644
--- a/pyload/web/app/scripts/views/linkgrabber/packageView.js
+++ b/pyload/web/app/scripts/views/linkgrabber/packageView.js
@@ -39,9 +39,19 @@ define(['jquery', 'underscore', 'backbone', 'app', 'hbs!tpl/linkgrabber/package'
return false;
},
- renamePackage: function() {
+ renamePackage: function(e) {
+ e.stopPropagation();
+
this.ui.name.addClass('edit');
this.ui.name.find('input').focus();
+
+ var self = this;
+ $(document).one('click', function() {
+ self.ui.name.removeClass('edit');
+ self.ui.name.focus();
+ });
+
+ return false;
},
saveName: function(e) {
diff --git a/pyload/web/app/scripts/views/setup/finishedView.js b/pyload/web/app/scripts/views/setup/finishedView.js
new file mode 100644
index 000000000..9f0f8db19
--- /dev/null
+++ b/pyload/web/app/scripts/views/setup/finishedView.js
@@ -0,0 +1,25 @@
+define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/setup/finished'],
+ function($, Backbone, _, App, template) {
+ 'use strict';
+
+ return Backbone.Marionette.ItemView.extend({
+
+ name: 'Finished',
+ template: template,
+
+ events: {
+ 'click .btn-blue': 'confirm'
+ },
+
+ ui: {
+ },
+
+ onRender: function() {
+ },
+
+ confirm: function() {
+ this.model.submit();
+ }
+
+ });
+ }); \ No newline at end of file
diff --git a/pyload/web/app/scripts/views/setup/setupView.js b/pyload/web/app/scripts/views/setup/setupView.js
index 7636a0bc2..8ab6fba51 100644
--- a/pyload/web/app/scripts/views/setup/setupView.js
+++ b/pyload/web/app/scripts/views/setup/setupView.js
@@ -1,6 +1,6 @@
-define(['jquery', 'backbone', 'underscore', 'app', 'models/Setup', 'hbs!tpl/setup/layout', 'hbs!tpl/setup/actionbar',
- './welcomeView', './systemView'],
- function($, Backbone, _, App, Setup, template, templateBar, welcomeView, systemView) {
+define(['jquery', 'backbone', 'underscore', 'app', 'models/Setup', 'hbs!tpl/setup/layout', 'hbs!tpl/setup/actionbar', 'hbs!tpl/setup/error',
+ './welcomeView', './systemView', './userView', './finishedView'],
+ function($, Backbone, _, App, Setup, template, templateBar, templateError, welcomeView, systemView, userView, finishedView) {
'use strict';
return Backbone.Marionette.ItemView.extend({
@@ -15,11 +15,14 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/Setup', 'hbs!tpl/setu
pages: [
welcomeView,
- systemView
+ systemView,
+ userView,
+ finishedView
],
page: 0,
view: null,
+ error: null,
initialize: function() {
var self = this;
@@ -52,37 +55,66 @@ define(['jquery', 'backbone', 'underscore', 'app', 'models/Setup', 'hbs!tpl/setu
});
this.listenTo(this.model, 'page:next', function() {
- self.openPage(self.page++);
+ self.openPage(self.page + 1);
});
this.listenTo(this.model, 'page:prev', function() {
- self.openPage(self.page--);
+ self.openPage(self.page - 1);
});
+
+ this.listenTo(this.model, 'error', this.onError);
+ this.model.fetch();
},
openPage: function(page) {
console.log('Change page', page);
// check if number is reasonable
- if (!_.isNumber(page) || !_.isFinite(page))
+ if (!_.isNumber(page) || !_.isFinite(page) || page < 0 || page >= this.pages.length)
return;
if (page === this.page)
return;
+ // Render error directly
+ if (this.error) {
+ this.onRender();
+ return;
+ }
+
this.page = page;
- this.onRender();
+
+ var self = this;
+ this.ui.page.fadeOut({complete: function() {
+ self.onRender();
+ }});
this.model.trigger('page:changed', page);
},
+ onError: function(model, xhr) {
+ console.log('Setup error', xhr);
+ this.error = xhr;
+ this.onRender();
+ },
+
onRender: function() {
+
// close old opened view
if (this.view)
this.view.close();
- // TODO: animation
+ // Render error if occurred
+ if (this.error) {
+ this.ui.page.html(templateError(this.error));
+ return;
+ }
+
this.view = new this.pages[this.page]({model: this.model});
this.ui.page.empty();
- this.ui.page.append(this.view.render().$el);
+
+ var el = this.view.render().el;
+ this.ui.page.append(el);
+
+ this.ui.page.fadeIn();
}
});
diff --git a/pyload/web/app/scripts/views/setup/systemView.js b/pyload/web/app/scripts/views/setup/systemView.js
index 11e50213d..b4c0f7e12 100644
--- a/pyload/web/app/scripts/views/setup/systemView.js
+++ b/pyload/web/app/scripts/views/setup/systemView.js
@@ -8,12 +8,17 @@ define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/setup/system'],
template: template,
events: {
+ 'click .btn-blue': 'nextPage'
},
ui: {
},
onRender: function() {
+ },
+
+ nextPage: function() {
+ this.model.trigger('page:next');
}
});
diff --git a/pyload/web/app/scripts/views/setup/userView.js b/pyload/web/app/scripts/views/setup/userView.js
new file mode 100644
index 000000000..95eaa0dc2
--- /dev/null
+++ b/pyload/web/app/scripts/views/setup/userView.js
@@ -0,0 +1,39 @@
+define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/setup/user'],
+ function($, Backbone, _, App, template) {
+ 'use strict';
+
+ return Backbone.Marionette.ItemView.extend({
+
+ name: 'User',
+ template: template,
+
+ events: {
+ 'click .btn-blue': 'submit'
+ },
+
+ ui: {
+ username: '#username',
+ password: '#password',
+ password2: '#password2'
+ },
+
+ onRender: function() {
+ },
+
+ submit: function() {
+ var pw = this.ui.password.val();
+ var pw2 = this.ui.password2.val();
+
+ // TODO more checks and error messages
+ if (pw !== pw2) {
+ return;
+ }
+
+ this.model.set('user', this.ui.username.val());
+ this.model.set('password', pw);
+
+ this.model.trigger('page:next');
+ }
+
+ });
+ }); \ No newline at end of file
diff --git a/pyload/web/app/scripts/views/setup/welcomeView.js b/pyload/web/app/scripts/views/setup/welcomeView.js
index 4affc9075..a964e0d42 100644
--- a/pyload/web/app/scripts/views/setup/welcomeView.js
+++ b/pyload/web/app/scripts/views/setup/welcomeView.js
@@ -8,12 +8,17 @@ define(['jquery', 'backbone', 'underscore', 'app', 'hbs!tpl/setup/welcome'],
template: template,
events: {
+ 'click .btn-blue': 'nextPage'
},
ui: {
},
onRender: function() {
+ },
+
+ nextPage: function() {
+ this.model.trigger('page:next');
}
});
diff --git a/pyload/web/app/styles/default/main.less b/pyload/web/app/styles/default/main.less
index 6bf21e80b..6153b576e 100644
--- a/pyload/web/app/styles/default/main.less
+++ b/pyload/web/app/styles/default/main.less
@@ -13,10 +13,10 @@
@import "settings";
@import "accounts";
@import "admin";
+@import "setup";
@ResourcePath: "../..";
@DefaultFont: 'Abel', sans-serif;
// Changed dimensions
-@header-height: 70px;
-@footer-height: 66px; \ No newline at end of file
+@header-height: 70px;; \ No newline at end of file
diff --git a/pyload/web/app/styles/default/setup.less b/pyload/web/app/styles/default/setup.less
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/pyload/web/app/styles/default/setup.less
diff --git a/pyload/web/app/styles/default/style.less b/pyload/web/app/styles/default/style.less
index da0e68991..ad60e5b59 100644
--- a/pyload/web/app/styles/default/style.less
+++ b/pyload/web/app/styles/default/style.less
@@ -284,15 +284,4 @@ header { // background-color: @greyDark;
border-radius: 15px;
-moz-border-radius: 15px;
-webkit-border-radius: 15px;
-}
-
-/*
- Footer
-*/
-footer .copyright {
- background-size: 40px 40px;
- background-position: 12px center;
- height: 40px;
- padding-left: 40px;
- padding-top: 10px;
-}
+} \ No newline at end of file
diff --git a/pyload/web/app/templates/default/setup/error.html b/pyload/web/app/templates/default/setup/error.html
new file mode 100644
index 000000000..37ce51283
--- /dev/null
+++ b/pyload/web/app/templates/default/setup/error.html
@@ -0,0 +1,14 @@
+{{#ifEq status 410}}
+ <h2 class="text-warning">{{ _ "Setup timed out" }}</h2>
+ <p>{{ _ "Setup was closed due to inactivity. Please restart it to continue configuration." }}</p>
+{{else}}
+{{#ifEq status 409}}
+ <h2 class="text-success">{{ _ "Setup finished" }}</h2>
+ <p>{{ _ "Setup was successful. You can restart pyLoad now." }}</p>
+{{else}}
+ <h2 class="text-error">
+ {{ _ "Setup failed" }}
+ </h2>
+ <p>{{ _ "Try to restart it or open a bug report." }}</p>
+{{/ifEq}}
+{{/ifEq}} \ No newline at end of file
diff --git a/pyload/web/app/templates/default/setup/finished.html b/pyload/web/app/templates/default/setup/finished.html
new file mode 100644
index 000000000..22a97649b
--- /dev/null
+++ b/pyload/web/app/templates/default/setup/finished.html
@@ -0,0 +1,23 @@
+{{#if user}}
+
+<h2>
+ {{ _ "Nearly Done" }}
+</h2>
+
+<p>
+ {{ _ "Please check your settings." }}
+</p>
+
+<p>
+ <strong>Username:</strong> {{user}}
+</p>
+
+<button class="btn btn-large btn-blue">
+ {{ _ "Confirm" }}
+</button>
+
+{{else}}
+
+<h2>{{ _ "Please add a user first." }}</h2>
+
+{{/if}}
diff --git a/pyload/web/app/templates/default/setup/layout.html b/pyload/web/app/templates/default/setup/layout.html
index 7b75e53b1..2e986173a 100644
--- a/pyload/web/app/templates/default/setup/layout.html
+++ b/pyload/web/app/templates/default/setup/layout.html
@@ -3,5 +3,8 @@
{{ _ "Setup" }}
</h1>
</div>
-<div class="span8 setup-page">
+<div class="span8">
+ <div class="hero-unit setup-page">
+
+ </div>
</div> \ No newline at end of file
diff --git a/pyload/web/app/templates/default/setup/system.html b/pyload/web/app/templates/default/setup/system.html
index 84a217b19..0c5023669 100644
--- a/pyload/web/app/templates/default/setup/system.html
+++ b/pyload/web/app/templates/default/setup/system.html
@@ -1,5 +1,56 @@
-<h1>{{ _ "System" }} </h1>
+<h3>{{ _ "System" }} </h3>
-<h2>{{_ "Dependencies" }}</h2>
+<dl class="dl-horizontal">
+ {{#each system}}
+ <dt>{{ @key }}</dt>
+ <dd>{{ this }}</dd>
+ {{/each}}
+</dl>
-<h2>{{ _ "Optional" }}</h2> \ No newline at end of file
+<h3>{{_ "Dependencies" }}</h3>
+<dl class="dl-horizontal">
+ {{#each deps.core}}
+ <dt>{{ name }}</dt>
+ <dd>
+ {{#if avail}}
+ <span class="text-success">
+ <i class="icon-ok"></i>
+ {{#if v}}
+ ({{v}})
+ {{/if}}
+ </span>
+ {{else}}
+ <span class="text-error">
+ <i class="icon-remove"></i>
+ </span>
+ {{/if}}
+ </dd>
+ {{/each}}
+</dl>
+
+
+<h4>{{ _ "Optional" }}</h4>
+<dl class="dl-horizontal">
+ {{#each deps.opt}}
+ <dt>{{ name }}</dt>
+ <dd>
+ {{#if avail}}
+ <span class="text-success">
+ {{ _ "available" }}
+ {{#if v}}
+ ({{v}})
+ {{/if}}
+ </span>
+ {{else}}
+ <span class="text-error">
+ {{ _ "not available" }}
+ </span>
+ {{/if}}
+ </dd>
+ {{/each}}
+</dl>
+
+
+<button class="btn btn-blue">
+ {{ _ "Next" }}
+</button> \ No newline at end of file
diff --git a/pyload/web/app/templates/default/setup/user.html b/pyload/web/app/templates/default/setup/user.html
new file mode 100644
index 000000000..fe3f2de71
--- /dev/null
+++ b/pyload/web/app/templates/default/setup/user.html
@@ -0,0 +1,34 @@
+<form class="form-horizontal">
+ <div class="control-group">
+ <label class="control-label">
+ Username
+ </label>
+
+ <div class="controls">
+ <input type="text" id="username" placeholder="User">
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label">
+ Password
+ </label>
+
+ <div class="controls">
+ <input type="password" id="password">
+ </div>
+ </div>
+ <div class="control-group">
+ <label class="control-label">
+ Password (again)
+ </label>
+
+ <div class="controls">
+ <input type="password" id="password2">
+ </div>
+ </div>
+ <div class="control-group">
+ <div class="controls">
+ <a class="btn btn-blue">Submit</a>
+ </div>
+ </div>
+</form> \ No newline at end of file
diff --git a/pyload/web/app/templates/default/setup/welcome.html b/pyload/web/app/templates/default/setup/welcome.html
index f5c5af4d7..5a4f74d9f 100644
--- a/pyload/web/app/templates/default/setup/welcome.html
+++ b/pyload/web/app/templates/default/setup/welcome.html
@@ -1,16 +1,14 @@
-<div class="hero-unit">
- <h1>{{ _ "Welcome!" }}</h1>
+<h1>{{ _ "Welcome!" }}</h1>
- <p>{{ _ "pyLoad is running and ready for configuration." }}</p>
+<p>{{ _ "pyLoad is running and ready for configuration." }}</p>
- <p>
- {{ _ "Select your language:" }}
- <select>
- <option>en</option>
- </select>
- </p>
+<p>
+ {{ _ "Select your language:" }}
+ <select>
+ <option>en</option>
+ </select>
+</p>
- <button class="btn btn-large btn-blue">
- {{ _ "Start configuration" }}
- </button>
-</div> \ No newline at end of file
+<button class="btn btn-large btn-blue">
+ {{ _ "Start configuration" }}
+</button> \ No newline at end of file