Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/nedforce/devcms-core

  • Loading branch information...
commit f51964999be8b07bf2ccbf4dd6d292051b3fc134 2 parents 1fe6eb7 + 67bbdd0
@vanderhoorn vanderhoorn authored
View
1  app/controllers/admin/settings_controller.rb
@@ -23,6 +23,7 @@ def index
{ :key => s.key,
:alt => s.alt,
:value => s.value,
+ :type => s.type,
:id => s.id
}
end
View
66 app/views/admin/settings/index.html.erb
@@ -12,22 +12,41 @@ Ext.onReady(function(){
// the column model has information about grid columns
// dataIndex maps the column to the specific data field in
// the data store (created below)
- var cm = new Ext.grid.ColumnModel([{
- id: 'id',
- header: "<%= I18n.t('settings.key') %>",
- dataIndex: 'key',
- width: 250
- },{
- header: "<%= I18n.t('settings.alt') %>",
- dataIndex: 'alt',
- width: 400
- },{
- header: "<%= I18n.t('settings.value') %>",
- dataIndex: 'value',
- width: 500,
- editor: new fm.TextField()
- }
- ]);
+ var cm = new Ext.grid.ColumnModel({
+ columns:
+ [{
+ id: 'id',
+ header: "<%= I18n.t('settings.key') %>",
+ dataIndex: 'key',
+ width: 250
+ },{
+ header: "<%= I18n.t('settings.alt') %>",
+ dataIndex: 'alt',
+ width: 400
+ },{
+ header: "<%= I18n.t('settings.value') %>",
+ dataIndex: 'value',
+ width: 500,
+ editable: true,
+ renderer: setting_value_renderer
+ }
+ ],
+ editors: {
+ 'default': new Ext.grid.GridEditor(new Ext.form.TextField({})),
+ 'password': new Ext.grid.GridEditor(new Ext.form.TextField({ inputType: 'password' })),
+ 'integer': new Ext.grid.GridEditor(new Ext.form.NumberField({ style: 'text-align: left' })),
+ 'float': new Ext.grid.GridEditor(new Ext.form.NumberField({ style: 'text-align: left' })),
+ 'datetime': new Ext.grid.GridEditor(new Ext.form.DateField({ format: "d-m-Y" }))
+ },
+ getCellEditor: function(colIndex, rowIndex) {
+ var field = this.getDataIndex(colIndex);
+ if (field == 'value') {
+ var rec = store.getAt(rowIndex);
+ return this.editors[rec.get('type')] || this.editors['default'];
+ }
+ return Ext.grid.ColumnModel.prototype.getCellEditor.call(this, colIndex, rowIndex);
+ }
+ });
// by default columns are sortable
cm.defaultSortable = true;
@@ -46,7 +65,7 @@ Ext.onReady(function(){
id: 'id',
totalProperty: 'total_count'
},
- [ 'key', 'alt', 'value' ]
+ [ 'key', 'alt', 'value', 'type' ]
),
autoLoad: {params: {start: 0, limit: perPage}}
@@ -76,6 +95,19 @@ Ext.onReady(function(){
'afteredit': handleEdit
}
});
+
+ function setting_value_renderer(value, metaData, record, rowIndex, colIndex,store) {
+ if(record.data.type == 'password') {
+ pass = '';
+ for(i=0;i < value.length; i++) pass += '*'
+
+ return pass;
+ }
+ else if(record.data.type == 'datetime') {
+ return new Date(value).format("d-m-Y");
+ }
+ else return value;
+ }
function handleEdit(editEvent) {
Ext.Ajax.request({
View
2  config/environment.rb
@@ -22,7 +22,7 @@
config.gem 'haml', :version => '~> 3.0'
config.gem 'libxml-ruby', :version => "~> 2.2.0", :lib => 'libxml'
config.gem 'pg', :version => '~> 0.11.0'
-config.gem 'settler', :version => '~> 1.2.0'
+config.gem 'settler', :version => '~> 1.2.3'
config.gem 'shuber-sortable', :version => "~> 1.0.6", :lib => 'sortable', :source => "http://gems.github.com"
# use the plugin instead, shuber isn't available as gem anymore
config.gem 'tidy', :version => '1.1.2'
Please sign in to comment.
Something went wrong with that request. Please try again.