Some more info in About tab
This commit is contained in:
@@ -33,7 +33,7 @@ def addView(route, func, static = False):
|
|||||||
@web.route('/')
|
@web.route('/')
|
||||||
@requires_auth
|
@requires_auth
|
||||||
def index():
|
def index():
|
||||||
return render_template('index.html', sep = os.sep, fireEvent = fireEvent)
|
return render_template('index.html', sep = os.sep, fireEvent = fireEvent, env = Env)
|
||||||
|
|
||||||
@app.errorhandler(404)
|
@app.errorhandler(404)
|
||||||
def page_not_found(error):
|
def page_not_found(error):
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ def getOptions(base_path, args):
|
|||||||
parser.add_argument('-d', '--daemon', action = 'store_true',
|
parser.add_argument('-d', '--daemon', action = 'store_true',
|
||||||
dest = 'daemonize', help = 'Daemonize the app')
|
dest = 'daemonize', help = 'Daemonize the app')
|
||||||
parser.add_argument('-g', '--nogit', action = 'store_true',
|
parser.add_argument('-g', '--nogit', action = 'store_true',
|
||||||
dest = 'git', help = 'Running from git')
|
dest = 'nogit', help = 'Running from git')
|
||||||
|
|
||||||
options = parser.parse_args(args)
|
options = parser.parse_args(args)
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ def runCouchPotato(options, base_path, args):
|
|||||||
|
|
||||||
|
|
||||||
# Register environment settings
|
# Register environment settings
|
||||||
Env.set('uses_git', not options.git)
|
Env.set('uses_git', options.nogit)
|
||||||
Env.set('app_dir', base_path)
|
Env.set('app_dir', base_path)
|
||||||
Env.set('data_dir', data_dir)
|
Env.set('data_dir', data_dir)
|
||||||
Env.set('log_path', os.path.join(log_dir, 'CouchPotato.log'))
|
Env.set('log_path', os.path.join(log_dir, 'CouchPotato.log'))
|
||||||
@@ -66,6 +66,7 @@ def runCouchPotato(options, base_path, args):
|
|||||||
Env.set('quiet', options.quiet)
|
Env.set('quiet', options.quiet)
|
||||||
Env.set('daemonize', options.daemonize)
|
Env.set('daemonize', options.daemonize)
|
||||||
Env.set('args', args)
|
Env.set('args', args)
|
||||||
|
Env.set('options', options)
|
||||||
|
|
||||||
# Determine debug
|
# Determine debug
|
||||||
debug = options.debug or Env.setting('debug', default = False)
|
debug = options.debug or Env.setting('debug', default = False)
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ var CouchPotato = new Class({
|
|||||||
|
|
||||||
self.c.addEvent('click:relay(a:not([target=_blank]))', self.pushState.bind(self));
|
self.c.addEvent('click:relay(a:not([target=_blank]))', self.pushState.bind(self));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getOption: function(name){
|
||||||
|
return this.options[name];
|
||||||
|
},
|
||||||
|
|
||||||
pushState: function(e){
|
pushState: function(e){
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ var AboutSettingTab = new Class({
|
|||||||
|
|
||||||
self.createAbout();
|
self.createAbout();
|
||||||
|
|
||||||
})
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -39,6 +39,16 @@ var AboutSettingTab = new Class({
|
|||||||
self.settings.createGroup({
|
self.settings.createGroup({
|
||||||
'label': 'About CouchPotato'
|
'label': 'About CouchPotato'
|
||||||
}).inject(self.content).adopt(
|
}).inject(self.content).adopt(
|
||||||
|
new Element('dl.info').adopt(
|
||||||
|
new Element('dt[text=Version]'),
|
||||||
|
new Element('dd', {'text': Updater.info()}),
|
||||||
|
new Element('dt[text=Directories]'),
|
||||||
|
new Element('dd', {'text': App.getOption('app_dir')}),
|
||||||
|
new Element('dd', {'text': App.getOption('data_dir')}),
|
||||||
|
new Element('dt[text=Startup Args]'),
|
||||||
|
new Element('dd', {'text': App.getOption('args')}),
|
||||||
|
new Element('dd', {'html': App.getOption('options')})
|
||||||
|
),
|
||||||
new Element('div.shutdown').adopt(
|
new Element('div.shutdown').adopt(
|
||||||
new Element('a.button.red', {
|
new Element('a.button.red', {
|
||||||
'text': 'Shutdown',
|
'text': 'Shutdown',
|
||||||
@@ -92,5 +102,5 @@ var AboutSettingTab = new Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.addEvent('domready', function(){
|
window.addEvent('domready', function(){
|
||||||
window.About = new AboutSettingTab();
|
new AboutSettingTab();
|
||||||
});
|
});
|
||||||
@@ -675,71 +675,3 @@ Option.Directory = new Class({
|
|||||||
return self.input.get('text');
|
return self.input.get('text');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var AboutSettingTab = new Class({
|
|
||||||
|
|
||||||
tab: '',
|
|
||||||
content: '',
|
|
||||||
|
|
||||||
initialize: function(){
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
App.addEvent('load', self.addSettings.bind(self))
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
addSettings: function(){
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
self.settings = App.getPage('Settings')
|
|
||||||
self.settings.addEvent('create', function(){
|
|
||||||
var tab = self.settings.createTab('about', {
|
|
||||||
'label': 'About',
|
|
||||||
'name': 'about'
|
|
||||||
});
|
|
||||||
|
|
||||||
self.tab = tab.tab;
|
|
||||||
self.content = tab.content;
|
|
||||||
|
|
||||||
self.createAbout();
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Profiles
|
|
||||||
*/
|
|
||||||
createAbout: function(){
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
var non_core_profiles = Object.filter(self.profiles, function(profile){ return !profile.isCore() });
|
|
||||||
var count = Object.getLength(non_core_profiles);
|
|
||||||
|
|
||||||
self.settings.createGroup({
|
|
||||||
'label': 'About CouchPotato'
|
|
||||||
}).inject(self.content).adopt(
|
|
||||||
new Element('a.button.red', {
|
|
||||||
'text': 'Shutdown',
|
|
||||||
'events': {
|
|
||||||
'click': function(){
|
|
||||||
Api.request('app.shutdown');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
new Element('a.button.orange', {
|
|
||||||
'text': 'Restart',
|
|
||||||
'events': {
|
|
||||||
'click': function(){
|
|
||||||
Api.request('app.restart');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
window.About = new AboutSettingTab();
|
|
||||||
|
|||||||
@@ -61,7 +61,11 @@
|
|||||||
File.Type.setup({{ fireEvent('file.types', single = True)|tojson|safe }});
|
File.Type.setup({{ fireEvent('file.types', single = True)|tojson|safe }});
|
||||||
|
|
||||||
App.setup({
|
App.setup({
|
||||||
'base_url': '{{ request.path }}'
|
'base_url': '{{ request.path }}',
|
||||||
|
'args': '{{ env.get('args') }}',
|
||||||
|
'options': '{{ env.get('options') }}',
|
||||||
|
'app_dir': '{{ env.get('app_dir') }}',
|
||||||
|
'data_dir': '{{ env.get('data_dir') }}'
|
||||||
});
|
});
|
||||||
|
|
||||||
//Wizard.start.delay(100, Wizard);
|
//Wizard.start.delay(100, Wizard);
|
||||||
|
|||||||
Reference in New Issue
Block a user