manage 1.3.20 → 1.3.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/README.rdoc +96 -96
- data/Rakefile +31 -31
- data/app/assets/javascripts/manage/application.js +0 -2
- data/app/assets/javascripts/manage/collection_actions.js.coffee +30 -30
- data/app/assets/javascripts/manage/handlers.js.coffee +46 -46
- data/app/assets/javascripts/manage/init.js.coffee +1 -4
- data/app/assets/javascripts/manage/table_checkboxes.js.coffee +11 -11
- data/app/assets/stylesheets/manage/application.css.scss +1 -2
- data/app/assets/stylesheets/manage/layout.css.scss +44 -44
- data/app/controllers/manage/application_controller.rb +13 -13
- data/app/controllers/manage/dashboards_controller.rb +4 -4
- data/app/controllers/manage/resource_controller.rb +125 -125
- data/app/controllers/manage/responder.rb +11 -11
- data/app/controllers/manage/sessions_controller.rb +11 -11
- data/app/helpers/manage/application_helper.rb +42 -42
- data/app/helpers/manage/form_helper.rb +21 -21
- data/app/helpers/manage/resource_helper.rb +77 -77
- data/app/models/admin_user.rb +4 -4
- data/app/views/layouts/manage/_main_menu.html.slim +52 -52
- data/app/views/layouts/manage/application.html.slim +39 -39
- data/app/views/layouts/manage/sign_in.html.slim +30 -30
- data/app/views/manage/resource/_form.html.slim +4 -4
- data/app/views/manage/resource/index.html.slim +18 -18
- data/app/views/manage/resource/index/_collection_actions.html.slim +2 -2
- data/app/views/manage/resource/index/_count.html.slim +6 -6
- data/app/views/manage/resource/index/_filters.html.slim +22 -22
- data/app/views/manage/resource/index/_table.html.slim +25 -25
- data/app/views/manage/resource/show.html.slim +10 -10
- data/app/views/manage/sessions/new.html.slim +10 -10
- data/config/initializers/devise.rb +247 -247
- data/config/initializers/session_store.rb +3 -3
- data/config/initializers/simple_form.rb +145 -145
- data/config/initializers/simple_form_foundation.rb +26 -26
- data/config/locales/devise.en.yml +59 -59
- data/config/locales/en.yml +20 -20
- data/config/routes.rb +10 -10
- data/db/migrate/20131204142720_create_admin_users.rb +24 -24
- data/lib/manage.rb +5 -5
- data/lib/manage/engine.rb +21 -21
- data/lib/manage/fields.rb +6 -6
- data/lib/manage/fields/reader.rb +57 -57
- data/lib/manage/fields/searcher.rb +51 -51
- data/lib/manage/version.rb +1 -1
- data/lib/tasks/manage_tasks.rake +15 -15
- data/lib/templates/erb/scaffold/_form.html.erb +13 -13
- data/spec/controllers/manage/resource_controller_spec.rb +29 -29
- data/spec/dummy/README.rdoc +28 -28
- data/spec/dummy/Rakefile +6 -6
- data/spec/dummy/app/assets/javascripts/application.js +13 -13
- data/spec/dummy/app/assets/stylesheets/application.css +13 -13
- data/spec/dummy/app/controllers/application_controller.rb +5 -5
- data/spec/dummy/app/controllers/manage/posts_controller.rb +4 -4
- data/spec/dummy/app/helpers/application_helper.rb +2 -2
- data/spec/dummy/app/models/post.rb +3 -3
- data/spec/dummy/app/models/user.rb +5 -5
- data/spec/dummy/app/views/layouts/application.html.erb +14 -14
- data/spec/dummy/bin/bundle +3 -3
- data/spec/dummy/bin/rails +4 -4
- data/spec/dummy/bin/rake +4 -4
- data/spec/dummy/config.ru +4 -4
- data/spec/dummy/config/application.rb +24 -24
- data/spec/dummy/config/boot.rb +5 -5
- data/spec/dummy/config/database.yml +25 -25
- data/spec/dummy/config/environment.rb +5 -5
- data/spec/dummy/config/environments/development.rb +29 -29
- data/spec/dummy/config/environments/production.rb +80 -80
- data/spec/dummy/config/environments/test.rb +36 -36
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -7
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -4
- data/spec/dummy/config/initializers/inflections.rb +16 -16
- data/spec/dummy/config/initializers/mime_types.rb +5 -5
- data/spec/dummy/config/initializers/secret_token.rb +12 -12
- data/spec/dummy/config/initializers/session_store.rb +3 -3
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -14
- data/spec/dummy/config/locales/en.yml +23 -23
- data/spec/dummy/config/routes.rb +10 -10
- data/spec/dummy/db/migrate/20130716083410_init_migration.rb +21 -21
- data/spec/dummy/db/schema.rb +53 -53
- data/spec/dummy/public/404.html +58 -58
- data/spec/dummy/public/422.html +58 -58
- data/spec/dummy/public/500.html +57 -57
- data/spec/fields/reader_spec.rb +79 -79
- data/spec/spec_helper.rb +24 -24
- metadata +88 -110
- data/app/assets/javascripts/manage/tinymce/plugins/code/plugin.min.js +0 -1
- data/app/assets/javascripts/manage/tinymce/theme.min.js +0 -1
- data/app/assets/javascripts/manage/tinymce/tinymce.min.js +0 -9
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/content.inline.min.css +0 -1
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/content.min.css +0 -1
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/fonts/readme.md +0 -1
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/fonts/tinymce-small.svg +0 -175
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/fonts/tinymce.svg +0 -153
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/img/object.gif +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/img/wline.gif +0 -0
- data/app/assets/stylesheets/manage/tinymce/skins/lightgray/skin.min.css +0 -1
- data/spec/dummy/log/test.log +0 -0
@@ -1,12 +1,12 @@
|
|
1
|
-
class TableCheckboxes
|
2
|
-
constructor: (el) ->
|
3
|
-
$el = $(el)
|
4
|
-
$mainContainer = $el.closest('table')
|
5
|
-
|
6
|
-
$el.on 'click', (event, element)->
|
7
|
-
check = if $el.is(':checked') then true else false
|
8
|
-
|
9
|
-
$mainContainer.find('.rs').each ->
|
10
|
-
$(@).prop('checked', check)
|
11
|
-
|
1
|
+
class TableCheckboxes
|
2
|
+
constructor: (el) ->
|
3
|
+
$el = $(el)
|
4
|
+
$mainContainer = $el.closest('table')
|
5
|
+
|
6
|
+
$el.on 'click', (event, element)->
|
7
|
+
check = if $el.is(':checked') then true else false
|
8
|
+
|
9
|
+
$mainContainer.find('.rs').each ->
|
10
|
+
$(@).prop('checked', check)
|
11
|
+
|
12
12
|
Handlers.register 'TableCheckboxes', TableCheckboxes
|
@@ -1,45 +1,45 @@
|
|
1
|
-
.main {
|
2
|
-
margin: 0 10px;
|
3
|
-
}
|
4
|
-
|
5
|
-
.row {
|
6
|
-
width: auto;
|
7
|
-
max-width: none;
|
8
|
-
margin-left: -10px;
|
9
|
-
margin-right: -10px;
|
10
|
-
margin-bottom: 0;
|
11
|
-
}
|
12
|
-
.row .columns, .row .row .columns {
|
13
|
-
padding-left: 10px;
|
14
|
-
padding-right: 10px;
|
15
|
-
}
|
16
|
-
|
17
|
-
table {
|
18
|
-
width: 100%;
|
19
|
-
|
20
|
-
ul.inline-list {
|
21
|
-
margin-bottom: 0;
|
22
|
-
line-height: inherit;
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
.pagination li.active {
|
27
|
-
@extend .current;
|
28
|
-
}
|
29
|
-
|
30
|
-
body.index {
|
31
|
-
.panel {
|
32
|
-
padding: 0 10px;
|
33
|
-
}
|
34
|
-
|
35
|
-
fieldset {
|
36
|
-
margin: 0;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
|
41
|
-
.collection_actions {
|
42
|
-
form {
|
43
|
-
display: inline-block;
|
44
|
-
}
|
1
|
+
.main {
|
2
|
+
margin: 0 10px;
|
3
|
+
}
|
4
|
+
|
5
|
+
.row {
|
6
|
+
width: auto;
|
7
|
+
max-width: none;
|
8
|
+
margin-left: -10px;
|
9
|
+
margin-right: -10px;
|
10
|
+
margin-bottom: 0;
|
11
|
+
}
|
12
|
+
.row .columns, .row .row .columns {
|
13
|
+
padding-left: 10px;
|
14
|
+
padding-right: 10px;
|
15
|
+
}
|
16
|
+
|
17
|
+
table {
|
18
|
+
width: 100%;
|
19
|
+
|
20
|
+
ul.inline-list {
|
21
|
+
margin-bottom: 0;
|
22
|
+
line-height: inherit;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
26
|
+
.pagination li.active {
|
27
|
+
@extend .current;
|
28
|
+
}
|
29
|
+
|
30
|
+
body.index {
|
31
|
+
.panel {
|
32
|
+
padding: 0 10px;
|
33
|
+
}
|
34
|
+
|
35
|
+
fieldset {
|
36
|
+
margin: 0;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
.collection_actions {
|
42
|
+
form {
|
43
|
+
display: inline-block;
|
44
|
+
}
|
45
45
|
}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
class Manage::ApplicationController < ActionController::Base
|
2
|
-
before_filter :auth_user!
|
3
|
-
|
4
|
-
def auth_user!
|
5
|
-
redirect_to new_admin_user_session_path unless admin_user_signed_in?
|
6
|
-
end
|
7
|
-
|
8
|
-
helper_method :current_user
|
9
|
-
def current_user
|
10
|
-
current_admin_user
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
1
|
+
class Manage::ApplicationController < ActionController::Base
|
2
|
+
before_filter :auth_user!
|
3
|
+
|
4
|
+
def auth_user!
|
5
|
+
redirect_to new_admin_user_session_path unless admin_user_signed_in?
|
6
|
+
end
|
7
|
+
|
8
|
+
helper_method :current_user
|
9
|
+
def current_user
|
10
|
+
current_admin_user
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class Manage::DashboardsController < Manage::ApplicationController
|
2
|
-
def index
|
3
|
-
end
|
4
|
-
end
|
1
|
+
class Manage::DashboardsController < Manage::ApplicationController
|
2
|
+
def index
|
3
|
+
end
|
4
|
+
end
|
@@ -1,125 +1,125 @@
|
|
1
|
-
require_dependency "manage/application_controller"
|
2
|
-
require_dependency 'kaminari'
|
3
|
-
|
4
|
-
class Manage::ResourceController < Manage::ApplicationController
|
5
|
-
inherit_resources
|
6
|
-
|
7
|
-
cattr_accessor :per_page
|
8
|
-
|
9
|
-
self.responder = Manage::Responder
|
10
|
-
|
11
|
-
layout 'manage/application'
|
12
|
-
|
13
|
-
respond_to :html
|
14
|
-
|
15
|
-
helper_method :list_index_fields, :list_edit_fields, :list_search_fields, :list_action_links, :resource_actions, :collection_actions
|
16
|
-
|
17
|
-
def end_of_association_chain
|
18
|
-
if self.resources_configuration[:self][:search_fields].blank?
|
19
|
-
self.class.search_fields :all
|
20
|
-
end
|
21
|
-
|
22
|
-
config = self.resources_configuration[:self]
|
23
|
-
@search = config[:search].new(clean_search_params(params[:f]))
|
24
|
-
|
25
|
-
@search.results
|
26
|
-
end
|
27
|
-
|
28
|
-
protected
|
29
|
-
|
30
|
-
def clean_search_params(search_params)
|
31
|
-
return {} unless search_params.is_a?(Hash)
|
32
|
-
search_params = search_params.dup
|
33
|
-
search_params.delete_if do |key, value|
|
34
|
-
value == ''
|
35
|
-
end
|
36
|
-
search_params
|
37
|
-
end
|
38
|
-
|
39
|
-
def collection
|
40
|
-
assocation = end_of_association_chain.page(params[:page] || 1)
|
41
|
-
per_page ? assocation.per(per_page) : assocation
|
42
|
-
end
|
43
|
-
|
44
|
-
def permitted_params
|
45
|
-
params.permit!
|
46
|
-
end
|
47
|
-
|
48
|
-
def self.index_fields(*fields)
|
49
|
-
setup_fields(:index_fields, *fields)
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.edit_fields(*fields)
|
53
|
-
setup_fields(:edit_fields, *fields)
|
54
|
-
end
|
55
|
-
|
56
|
-
def self.search_fields(*fields)
|
57
|
-
setup_fields(:search_fields, *fields)
|
58
|
-
|
59
|
-
config = self.resources_configuration[:self]
|
60
|
-
config[:search] = Manage::Fields::Searcher.generate_search_object(resource_class, config[:search_fields])
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.action_links(*fields)
|
64
|
-
setup_fields(:action_links, *fields)
|
65
|
-
end
|
66
|
-
|
67
|
-
def list_index_fields
|
68
|
-
list_fields(:index_fields)
|
69
|
-
end
|
70
|
-
|
71
|
-
def list_edit_fields
|
72
|
-
list_fields(:edit_fields)
|
73
|
-
end
|
74
|
-
|
75
|
-
def list_search_fields
|
76
|
-
list_fields(:search_fields)
|
77
|
-
end
|
78
|
-
|
79
|
-
def list_action_links
|
80
|
-
if self.resources_configuration[:self][:action_links].blank?
|
81
|
-
[]
|
82
|
-
else
|
83
|
-
self.resources_configuration[:self][:action_links]
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
#
|
88
|
-
# This doubles the list_action_links.
|
89
|
-
# It provides actions on existing resource.
|
90
|
-
# actions are used in index/show/edit screens
|
91
|
-
# returns html string
|
92
|
-
def resource_actions resource
|
93
|
-
nil
|
94
|
-
end
|
95
|
-
|
96
|
-
# This method provides links on which to submit all collection / selected items
|
97
|
-
# Example:
|
98
|
-
#
|
99
|
-
def collection_actions resource
|
100
|
-
nil
|
101
|
-
end
|
102
|
-
|
103
|
-
private
|
104
|
-
def self.setup_fields(key, *fields)
|
105
|
-
# :all means all the fields - default
|
106
|
-
if not fields.first.is_a?(Hash) and fields.first.to_sym == :all
|
107
|
-
options = fields.extract_options!
|
108
|
-
options[:except] ||= []
|
109
|
-
options[:include] ||= []
|
110
|
-
|
111
|
-
self.resources_configuration[:self][key] = (resource_class.attribute_names + Array(options[:include])) - Array(options[:except]).map(&:to_s)
|
112
|
-
else
|
113
|
-
self.resources_configuration[:self][key] = fields
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def list_fields(key)
|
118
|
-
if self.resources_configuration[:self][key].blank?
|
119
|
-
resource_class.attribute_names - %w(id created_at updated_at)
|
120
|
-
else
|
121
|
-
self.resources_configuration[:self][key]
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
end
|
1
|
+
require_dependency "manage/application_controller"
|
2
|
+
require_dependency 'kaminari'
|
3
|
+
|
4
|
+
class Manage::ResourceController < Manage::ApplicationController
|
5
|
+
inherit_resources
|
6
|
+
|
7
|
+
cattr_accessor :per_page
|
8
|
+
|
9
|
+
self.responder = Manage::Responder
|
10
|
+
|
11
|
+
layout 'manage/application'
|
12
|
+
|
13
|
+
respond_to :html
|
14
|
+
|
15
|
+
helper_method :list_index_fields, :list_edit_fields, :list_search_fields, :list_action_links, :resource_actions, :collection_actions
|
16
|
+
|
17
|
+
def end_of_association_chain
|
18
|
+
if self.resources_configuration[:self][:search_fields].blank?
|
19
|
+
self.class.search_fields :all
|
20
|
+
end
|
21
|
+
|
22
|
+
config = self.resources_configuration[:self]
|
23
|
+
@search = config[:search].new(clean_search_params(params[:f]))
|
24
|
+
|
25
|
+
@search.results
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
def clean_search_params(search_params)
|
31
|
+
return {} unless search_params.is_a?(Hash)
|
32
|
+
search_params = search_params.dup
|
33
|
+
search_params.delete_if do |key, value|
|
34
|
+
value == ''
|
35
|
+
end
|
36
|
+
search_params
|
37
|
+
end
|
38
|
+
|
39
|
+
def collection
|
40
|
+
assocation = end_of_association_chain.page(params[:page] || 1)
|
41
|
+
per_page ? assocation.per(per_page) : assocation
|
42
|
+
end
|
43
|
+
|
44
|
+
def permitted_params
|
45
|
+
params.permit!
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.index_fields(*fields)
|
49
|
+
setup_fields(:index_fields, *fields)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.edit_fields(*fields)
|
53
|
+
setup_fields(:edit_fields, *fields)
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.search_fields(*fields)
|
57
|
+
setup_fields(:search_fields, *fields)
|
58
|
+
|
59
|
+
config = self.resources_configuration[:self]
|
60
|
+
config[:search] = Manage::Fields::Searcher.generate_search_object(resource_class, config[:search_fields])
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.action_links(*fields)
|
64
|
+
setup_fields(:action_links, *fields)
|
65
|
+
end
|
66
|
+
|
67
|
+
def list_index_fields
|
68
|
+
list_fields(:index_fields)
|
69
|
+
end
|
70
|
+
|
71
|
+
def list_edit_fields
|
72
|
+
list_fields(:edit_fields)
|
73
|
+
end
|
74
|
+
|
75
|
+
def list_search_fields
|
76
|
+
list_fields(:search_fields)
|
77
|
+
end
|
78
|
+
|
79
|
+
def list_action_links
|
80
|
+
if self.resources_configuration[:self][:action_links].blank?
|
81
|
+
[]
|
82
|
+
else
|
83
|
+
self.resources_configuration[:self][:action_links]
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
#
|
88
|
+
# This doubles the list_action_links.
|
89
|
+
# It provides actions on existing resource.
|
90
|
+
# actions are used in index/show/edit screens
|
91
|
+
# returns html string
|
92
|
+
def resource_actions resource
|
93
|
+
nil
|
94
|
+
end
|
95
|
+
|
96
|
+
# This method provides links on which to submit all collection / selected items
|
97
|
+
# Example:
|
98
|
+
#
|
99
|
+
def collection_actions resource
|
100
|
+
nil
|
101
|
+
end
|
102
|
+
|
103
|
+
private
|
104
|
+
def self.setup_fields(key, *fields)
|
105
|
+
# :all means all the fields - default
|
106
|
+
if not fields.first.is_a?(Hash) and fields.first.to_sym == :all
|
107
|
+
options = fields.extract_options!
|
108
|
+
options[:except] ||= []
|
109
|
+
options[:include] ||= []
|
110
|
+
|
111
|
+
self.resources_configuration[:self][key] = (resource_class.attribute_names + Array(options[:include])) - Array(options[:except]).map(&:to_s)
|
112
|
+
else
|
113
|
+
self.resources_configuration[:self][key] = fields
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def list_fields(key)
|
118
|
+
if self.resources_configuration[:self][key].blank?
|
119
|
+
resource_class.attribute_names - %w(id created_at updated_at)
|
120
|
+
else
|
121
|
+
self.resources_configuration[:self][key]
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
# app/controllers/backend/responder.rb
|
2
|
-
class Manage::Responder < ::ActionController::Responder
|
3
|
-
|
4
|
-
include Responders::FlashResponder
|
5
|
-
include Responders::HttpCacheResponder
|
6
|
-
|
7
|
-
def initialize(*)
|
8
|
-
super
|
9
|
-
@flash_now = :on_failure
|
10
|
-
end
|
11
|
-
|
1
|
+
# app/controllers/backend/responder.rb
|
2
|
+
class Manage::Responder < ::ActionController::Responder
|
3
|
+
|
4
|
+
include Responders::FlashResponder
|
5
|
+
include Responders::HttpCacheResponder
|
6
|
+
|
7
|
+
def initialize(*)
|
8
|
+
super
|
9
|
+
@flash_now = :on_failure
|
10
|
+
end
|
11
|
+
|
12
12
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
module Manage
|
2
|
-
class SessionsController < ::Devise::SessionsController
|
3
|
-
layout "manage/sign_in"
|
4
|
-
|
5
|
-
def destroy
|
6
|
-
p 'what?'
|
7
|
-
super
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
1
|
+
module Manage
|
2
|
+
class SessionsController < ::Devise::SessionsController
|
3
|
+
layout "manage/sign_in"
|
4
|
+
|
5
|
+
def destroy
|
6
|
+
p 'what?'
|
7
|
+
super
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|