Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are there good stuff here? #25

Open
wants to merge 141 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
b0470f3
preview items before save
ishai Jul 23, 2013
df62785
fix view document
ishai Jul 23, 2013
16d1896
Do not save preview items
ishai Jul 25, 2013
4ba1957
show lat lng on geo field
ishai Aug 12, 2013
c16f81a
multiple select fields
ishai Aug 15, 2013
8d63071
make sure userpanel doesn't crash
ishai Aug 18, 2013
b296be6
formage dialogs
ishai Aug 19, 2013
4714b88
add sji
ishai Aug 21, 2013
643f036
spelling
ishai Aug 21, 2013
32e637a
underscore
ishai Aug 21, 2013
c6513b5
support indexes autocomplete
ishai Aug 26, 2013
9294b31
choices renamed to values
ishai Sep 3, 2013
18d550a
sdasd
ishai Sep 9, 2013
84cc0ae
sdasd
ishai Sep 10, 2013
d3a03dd
show field name in list fields,
ishai Sep 16, 2013
a433da2
1.4.5
ishai Sep 18, 2013
3f58775
fix duplicate
ishai Sep 22, 2013
5fe9f7e
duplicate fix
ishai Sep 26, 2013
45c540e
empty strings take over,
ishai Oct 1, 2013
19903b2
use dialogs in actions,
ishai Oct 7, 2013
77a96fb
forms context
ishai Oct 14, 2013
6c6a2ee
unlink depedencies check policies
ishai Oct 21, 2013
748a20a
print saving errors on admin
ishai Oct 21, 2013
c8d8879
internal fomidable
ishai Oct 30, 2013
8c99570
dont run forimdable twice
ishai Oct 30, 2013
26bfa99
1.4.15
ishai Nov 13, 2013
ab7e566
sdaa
ishai Nov 13, 2013
77768a4
qs and multiparty
ishai Nov 13, 2013
6de4346
fix null in input values
ishai Nov 17, 2013
0c72515
support indexed searches in admin search
ishai Nov 17, 2013
c18e894
dont set empty arrays as null
ishai Nov 17, 2013
12a04a0
datetime in UTC
ishai Nov 19, 2013
9d05a3d
ensure parsing to Date
ishai Nov 23, 2013
67a8b21
allow actions to return response to user
ishai Nov 24, 2013
de33a88
commit it
ishai Nov 26, 2013
a5fcfb9
set instead of placement
ishai Nov 26, 2013
86f3273
fix list field checkbox checked bug
ishai Dec 2, 2013
71e52aa
actions in document view
ishai Dec 3, 2013
6dd3ed2
show results on select2 with empty strings
ishai Jan 5, 2014
4636536
fixed local files storage
ishai Jan 5, 2014
e8147f4
admin set upload dir
ishai Jan 12, 2014
5ee06f9
1.2.27
ishai Jan 13, 2014
4d2b28a
bring back alert action result
ishai Jan 20, 2014
84e331a
return actions response
ishai Jan 20, 2014
d6ccdc2
file field timestamp
ishai Jan 27, 2014
63c2539
timepicker in Firefox
ishai Feb 11, 2014
19c61e8
added, geo area field and widget
ishai Feb 11, 2014
dec6351
show general error on form save
ishai Feb 26, 2014
ffe39ef
static markers
ishai Mar 3, 2014
6bedc91
rename permission table
ishai Mar 3, 2014
41ddacd
fix autocomplete widget null ref bug
ishai Mar 6, 2014
f7b006a
explicit filters
ishai Mar 31, 2014
c967daa
resume on multiparty parser
ishai Apr 7, 2014
78a76ea
update search
ishai Apr 8, 2014
3d67797
remove old embedded objects on save
ishai Apr 8, 2014
231d8d8
GeoPoint2
ishai Apr 9, 2014
375cd7e
ddd
ishai Apr 9, 2014
0db799c
check dependencies remove null
ishai Apr 22, 2014
360c02f
file field set to null
ishai Apr 28, 2014
42af584
automatic filter for enum fields
ishai Apr 28, 2014
0d0a8da
ability to ignore dependencies
ishai May 12, 2014
63a4c63
remove dependencies final
ishai May 12, 2014
8f9b124
formage filters in select
ishai May 25, 2014
bcbfe0d
readonly inputs
ishai May 27, 2014
9b9e9ff
aws content types
ishai Jun 3, 2014
9fe99c5
multiple file uploads
ishai Jun 17, 2014
773f0d2
allow enum empty
ishai Jul 30, 2014
ee3a50b
fix date time reset on load
ishai Aug 24, 2014
a130435
explicit versions
ishai Aug 31, 2014
f257cb3
fix it
ishai Aug 31, 2014
a632767
no cloudinary
ishai Aug 31, 2014
aa74d24
no ij
ishai Aug 31, 2014
29b3e63
no couldinary
ishai Sep 1, 2014
9d3db16
ddd
ishai Sep 1, 2014
4f74b22
aaaa
ishai Sep 1, 2014
bce85eb
DateTime Unix time
ishai Sep 1, 2014
cc8eabb
muldiple select2 when empty
ishai Sep 10, 2014
664f49f
no regex on dialogs
ishai Sep 28, 2014
13586c7
fix string filters
ishai Oct 21, 2014
7d60051
aaa
ishai Dec 14, 2014
c5aa143
aaffa
ishai Dec 14, 2014
eba8264
afafaf
ishai Dec 14, 2014
939ad80
Update widgets.js
Freakachoo Jan 18, 2015
62dad23
Merge pull request #1 from Freakachoo/patch-1
IshaiJaffe Jan 19, 2015
7fdda13
aaa
ishai Feb 25, 2015
92f9193
Merge branch 'master' of github.com:IshaiJaffe/formage-admin
ishai Feb 25, 2015
19305a3
remove with hooks from admin
ishai Feb 26, 2015
5f52d08
work with lodash
ishai Feb 26, 2015
247389e
bigger admin
ishai May 19, 2015
a5fb3de
fix crash
ishai Jun 24, 2015
9e1f403
fix single temp file
ishai Jul 2, 2015
9617515
nodejs 0.12 compatibilty
ishai Jul 27, 2015
7a95197
fix package.json
IshaiJaffe Jul 27, 2015
b9b133b
fix not object id _id
IshaiJaffe Jul 30, 2015
95eb09d
Merge branch 'master' of github.com:IshaiJaffe/formage-admin
IshaiJaffe Jul 30, 2015
89967cf
add forms static files
IshaiJaffe Jul 30, 2015
df1d028
support new body parser
IshaiJaffe Aug 4, 2015
8c04f2b
remove logs and warning
IshaiJaffe Aug 4, 2015
4070b3c
remove distinct (ineffiecent)
IshaiJaffe Aug 30, 2015
316e684
update format versions
IshaiJaffe Nov 3, 2015
23b1b42
update formage
IshaiJaffe Dec 17, 2015
f782be8
fix filters in admin
IshaiJaffe Jan 4, 2016
bbc39db
fix query for all types
IshaiJaffe Jan 4, 2016
510f8b6
scopes
IshaiJaffe Jan 31, 2016
ea0f1e6
remove redundant buggy code,
IshaiJaffe Feb 11, 2016
3fb3590
fix a bug when multiple same path list fields exists.
IshaiJaffe Feb 24, 2016
3816752
faf
IshaiJaffe Feb 29, 2016
3a43f55
export to CSV,
IshaiJaffe Mar 30, 2016
605c1c6
last touchups
IshaiJaffe Mar 30, 2016
517d60c
Add version to lodash to comply to node 6
davidraviv Aug 16, 2016
5796ff7
Merge pull request #2 from shukyisme/master
IshaiJaffe Aug 18, 2016
eddf5f8
remove un-changed dates
IshaiJaffe Aug 31, 2016
13c2c97
Merge branch 'master' of github.com:IshaiJaffe/formage-admin
IshaiJaffe Aug 31, 2016
aab3f87
remove readonly fields
IshaiJaffe Sep 8, 2016
04e7d72
default filter for models,
IshaiJaffe Oct 13, 2016
69d2219
ssad
IshaiJaffe Oct 13, 2016
b340e18
support embedded document without id
IshaiJaffe Dec 1, 2016
d5845a3
aadad
IshaiJaffe Dec 14, 2016
98def30
adadad
IshaiJaffe Dec 14, 2016
d216450
aaaaa
IshaiJaffe Dec 14, 2016
8438cb4
afafasd
IshaiJaffe Dec 14, 2016
2ce459f
aaaaaa
IshaiJaffe Feb 8, 2017
26b6a45
keep context when getting objects
IshaiJaffe Apr 24, 2017
e562a79
clone work
IshaiJaffe May 3, 2017
1e30306
actions and hooks
IshaiJaffe Jun 7, 2017
d15341b
hooks and stuff
IshaiJaffe Jun 7, 2017
db4e599
fix CSV for excel,
IshaiJaffe Jun 8, 2017
964295e
fix order_by link
IshaiJaffe Jun 8, 2017
ffe661b
fix empty dates
IshaiJaffe Jun 15, 2017
ccdacc2
action request
IshaiJaffe Jul 27, 2017
a1427f5
fixed crash in choices
IshaiJaffe Apr 12, 2018
0cc4bfb
injectable file storage
ishaixper Jul 1, 2018
2fd0a14
no returned URL
ishaixper Jul 1, 2018
f114e74
fix crash on item null
IshaiJaffe Oct 23, 2018
8e0b056
Merge branch 'master' of https://github.com/IshaiJaffe/formage-admin
IshaiJaffe Oct 23, 2018
a623d0e
support custom search select
IshaiJaffe Nov 5, 2018
0a6df91
removed warning
IshaiJaffe Nov 6, 2018
8bfc3ec
copy to clipboard
IshaiJaffe May 6, 2021
4fedb40
fix for node 18
ishaiunbabel Sep 6, 2023
044f369
Global actions
ishaiunbabel Dec 30, 2024
15d7a8e
Global actions
ishaiunbabel Dec 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/dump/
/node_modules/jade/node_modules/transformers/test/
*.tgz
/node_modules/buster
/node_modules
/node_modules/express
/node_modules/.bin
/node_modules/mocha
Expand Down
57 changes: 48 additions & 9 deletions AdminForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
if (!module.parent) console.error('Please don\'t call me directly.I am just the main app\'s minion.') || process.process.exit(1);

var forms = require('./forms')
, mongoose = require.main.require('mongoose')
, mongoose = require('mongoose')
, fields = forms.fields
, widgets = forms.widgets
, MongooseForm = forms.forms.MongooseForm
,_ = require('lodash')
, jest = require('jest');

var api_loaded = false;
Expand Down Expand Up @@ -36,7 +37,8 @@ var AdminForm = exports.AdminForm = MongooseForm.extend({
value.options.widget_options.data = value.options.widget_options.data || {};
value.options.widget_options.data.data = encodeURIComponent(JSON.stringify({
model: value.options.ref,
query: value.options.query || '/__value__/i.test(this.name || this.title || this._id.toString())'
query: value.options.query || '/__value__/i.test(this.name || this.title || this._id.toString())',
constraints:value.options.constraints
}));
value.widget = new widgets.AutocompleteWidget(value.options.widget_options);
}
Expand All @@ -45,7 +47,21 @@ var AdminForm = exports.AdminForm = MongooseForm.extend({
value.widget = new widgets.ComboBoxWidget(value.options.widget_options);
}
else if (value instanceof fields.ListField) {
self.scanFields(value.fields);
if(value.fields['__self__']){
var innerField = value.fields['__self__'];
if(innerField instanceof fields.RefField){
var options = _.extend({},
innerField.options,
value.options,{
required:value.required,
widget:null

});
form_fields[key] = new fields.MultiRefField(options,innerField.ref);
}
}
else
self.scanFields(value.fields);
}
});
},
Expand Down Expand Up @@ -86,9 +102,24 @@ var _JestAdminResource = jest.Resource.extend({
});
}
else {
var escaped_filters = filters.query.replace(_escaper, "\\$&");
var query = data.query.replace(/__value__/g, escaped_filters);
model.find({$where: query}).limit(40).exec(function (err, results) {
var qry;
var escaped_filters = filters.query.replace(_escaper, "\\$&") || '.';
var obj = data.constraints || {};
if(data.query.indexOf('__value__') > -1){
var query = data.query.replace(/__value__/g, escaped_filters);
obj['$where'] = query;
qry = model.find(obj);
}
else if(Array.isArray(data.query)){
qry = model.find(obj).or(data.query.map(function(field){
var obj = {};
obj[field] = new RegExp('^' + escaped_filters);
return obj;
}));
}else{
qry = model.find(obj).where(data.query,new RegExp('^' + escaped_filters));
}
qry.limit(20).exec(function (err, results) {
if (results) {
if (results.objects) {
results = results.objects;
Expand All @@ -109,14 +140,17 @@ exports.loadApi = function (app, path) {
api_loaded = true;
};

exports.AdminForm.getApiPath = function(){
return api_path;
}

var crypt = require('./models/mongoose_admin_user').crypt;


exports.AdminUserForm = AdminForm.extend({
init:function(request,options)
init:function(request,options,model)
{
this._super(request,options,mongoose.model('_MongooseAdminUser'));
this._super(request,options,model || mongoose.model('MongooseAdminUser'));
}
,get_fields:function(){
this._super();
Expand All @@ -131,7 +165,12 @@ exports.AdminUserForm = AdminForm.extend({

this.fields['password_again'] = new forms.fields.StringField({widget:forms.widgets.PasswordWidget,label:'Again'});

this.fieldsets[0].fields = ['username','is_superuser','permissions','current_password','password','password_again'];
let index = this.fieldsets[0].fields.indexOf('passwordHash');
if(index < 0)
index = this.fieldsets[0].fields.length;
this.fieldsets[0].fields.splice(index,1,'current_password','password','password_again');
if(this.fields['permissions'])
this.fields['permissions'].widget.limit = 500;

return fields;
},
Expand Down
Loading