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
data/config/locales/en.yml
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
en:
|
2
|
-
manage:
|
3
|
-
actions:
|
4
|
-
show: Show
|
5
|
-
edit: Edit
|
6
|
-
destroy: Delete
|
7
|
-
edit:
|
8
|
-
title: Edit %{model}
|
9
|
-
confirmations:
|
10
|
-
Are you sure: Are you sure?
|
11
|
-
flash:
|
12
|
-
actions:
|
13
|
-
create:
|
14
|
-
notice: '%{resource_name} was successfully created.'
|
15
|
-
alert: '%{resource_name} could not be created.'
|
16
|
-
update:
|
17
|
-
notice: '%{resource_name} was successfully updated.'
|
18
|
-
alert: '%{resource_name} could not be updated.'
|
19
|
-
destroy:
|
20
|
-
notice: '%{resource_name} was successfully destroyed.'
|
1
|
+
en:
|
2
|
+
manage:
|
3
|
+
actions:
|
4
|
+
show: Show
|
5
|
+
edit: Edit
|
6
|
+
destroy: Delete
|
7
|
+
edit:
|
8
|
+
title: Edit %{model}
|
9
|
+
confirmations:
|
10
|
+
Are you sure: Are you sure?
|
11
|
+
flash:
|
12
|
+
actions:
|
13
|
+
create:
|
14
|
+
notice: '%{resource_name} was successfully created.'
|
15
|
+
alert: '%{resource_name} could not be created.'
|
16
|
+
update:
|
17
|
+
notice: '%{resource_name} was successfully updated.'
|
18
|
+
alert: '%{resource_name} could not be updated.'
|
19
|
+
destroy:
|
20
|
+
notice: '%{resource_name} was successfully destroyed.'
|
21
21
|
alert: '%{resource_name} could not be destroyed.'
|
data/config/routes.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
Manage::Engine.routes.draw do
|
2
|
-
devise_for :admin_users, :class_name => "AdminUser", skip: :registrations, controllers: {
|
3
|
-
sessions: "manage/sessions"
|
4
|
-
}
|
5
|
-
|
6
|
-
resources :dashboards
|
7
|
-
resources :admin_users
|
8
|
-
|
9
|
-
root 'dashboards#index'
|
10
|
-
end
|
1
|
+
Manage::Engine.routes.draw do
|
2
|
+
devise_for :admin_users, :class_name => "AdminUser", skip: :registrations, controllers: {
|
3
|
+
sessions: "manage/sessions"
|
4
|
+
}
|
5
|
+
|
6
|
+
resources :dashboards
|
7
|
+
resources :admin_users
|
8
|
+
|
9
|
+
root 'dashboards#index'
|
10
|
+
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
class CreateAdminUsers < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
create_table "admin_users", force: true do |t|
|
4
|
-
t.string "email", default: "", null: false
|
5
|
-
t.string "encrypted_password", default: "", null: false
|
6
|
-
t.string "reset_password_token"
|
7
|
-
t.datetime "reset_password_sent_at"
|
8
|
-
t.datetime "remember_created_at"
|
9
|
-
t.integer "sign_in_count", default: 0
|
10
|
-
t.datetime "current_sign_in_at"
|
11
|
-
t.datetime "last_sign_in_at"
|
12
|
-
t.string "current_sign_in_ip"
|
13
|
-
t.string "last_sign_in_ip"
|
14
|
-
t.integer "failed_attempts", default: 0
|
15
|
-
t.string "unlock_token"
|
16
|
-
t.datetime "locked_at"
|
17
|
-
t.datetime "created_at"
|
18
|
-
t.datetime "updated_at"
|
19
|
-
end
|
20
|
-
|
21
|
-
add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree
|
22
|
-
add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree
|
23
|
-
end
|
24
|
-
end
|
1
|
+
class CreateAdminUsers < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table "admin_users", force: true do |t|
|
4
|
+
t.string "email", default: "", null: false
|
5
|
+
t.string "encrypted_password", default: "", null: false
|
6
|
+
t.string "reset_password_token"
|
7
|
+
t.datetime "reset_password_sent_at"
|
8
|
+
t.datetime "remember_created_at"
|
9
|
+
t.integer "sign_in_count", default: 0
|
10
|
+
t.datetime "current_sign_in_at"
|
11
|
+
t.datetime "last_sign_in_at"
|
12
|
+
t.string "current_sign_in_ip"
|
13
|
+
t.string "last_sign_in_ip"
|
14
|
+
t.integer "failed_attempts", default: 0
|
15
|
+
t.string "unlock_token"
|
16
|
+
t.datetime "locked_at"
|
17
|
+
t.datetime "created_at"
|
18
|
+
t.datetime "updated_at"
|
19
|
+
end
|
20
|
+
|
21
|
+
add_index "admin_users", ["email"], name: "index_admin_users_on_email", unique: true, using: :btree
|
22
|
+
add_index "admin_users", ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree
|
23
|
+
end
|
24
|
+
end
|
data/lib/manage.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require "manage/engine"
|
2
|
-
require "manage/fields"
|
3
|
-
|
4
|
-
module Manage
|
5
|
-
end
|
1
|
+
require "manage/engine"
|
2
|
+
require "manage/fields"
|
3
|
+
|
4
|
+
module Manage
|
5
|
+
end
|
data/lib/manage/engine.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
require 'kaminari'
|
2
|
-
require 'responders'
|
3
|
-
require 'inherited_resources'
|
4
|
-
require 'simple_form'
|
5
|
-
require 'jquery-rails'
|
6
|
-
require 'zurb-foundation'
|
7
|
-
require 'devise'
|
8
|
-
require 'slim'
|
9
|
-
require 'search_object'
|
10
|
-
|
11
|
-
module Manage
|
12
|
-
class Engine < ::Rails::Engine
|
13
|
-
isolate_namespace Manage
|
14
|
-
|
15
|
-
config.generators do |g|
|
16
|
-
g.test_framework :rspec, :fixture => false
|
17
|
-
g.assets false
|
18
|
-
g.helper false
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
1
|
+
require 'kaminari'
|
2
|
+
require 'responders'
|
3
|
+
require 'inherited_resources'
|
4
|
+
require 'simple_form'
|
5
|
+
require 'jquery-rails'
|
6
|
+
require 'zurb-foundation'
|
7
|
+
require 'devise'
|
8
|
+
require 'slim'
|
9
|
+
require 'search_object'
|
10
|
+
|
11
|
+
module Manage
|
12
|
+
class Engine < ::Rails::Engine
|
13
|
+
isolate_namespace Manage
|
14
|
+
|
15
|
+
config.generators do |g|
|
16
|
+
g.test_framework :rspec, :fixture => false
|
17
|
+
g.assets false
|
18
|
+
g.helper false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/manage/fields.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
module Manage
|
2
|
-
module Fields
|
3
|
-
autoload :Reader, 'manage/fields/reader'
|
4
|
-
autoload :Searcher, 'manage/fields/searcher'
|
5
|
-
end
|
6
|
-
end
|
1
|
+
module Manage
|
2
|
+
module Fields
|
3
|
+
autoload :Reader, 'manage/fields/reader'
|
4
|
+
autoload :Searcher, 'manage/fields/searcher'
|
5
|
+
end
|
6
|
+
end
|
data/lib/manage/fields/reader.rb
CHANGED
@@ -1,57 +1,57 @@
|
|
1
|
-
module Manage
|
2
|
-
module Fields
|
3
|
-
class Reader
|
4
|
-
class << self
|
5
|
-
def field_value(scope, field_data)
|
6
|
-
current_field, rest_field_parts, custom_query, custom_format = _parse_field_data(field_data)
|
7
|
-
value = scope.public_send(current_field)
|
8
|
-
|
9
|
-
if _is_field_relation?(value)
|
10
|
-
value = custom_query.present? ? custom_query.call(value) : value
|
11
|
-
|
12
|
-
value.map do |entity|
|
13
|
-
("<a href=\"#{current_field}/#{entity.id}\">#{custom_format.present? ? custom_format.call(entity) : entity.id }</a>")
|
14
|
-
end.join(', ').html_safe
|
15
|
-
else
|
16
|
-
rest_field_parts.empty? ? value : field_value(value, rest_field_parts.join('.'))
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def field_title(resource_class, field_data, prefix='')
|
21
|
-
current_field, rest_field_parts = _parse_field_data(field_data)
|
22
|
-
title = resource_class.human_attribute_name(current_field)
|
23
|
-
|
24
|
-
rest_field_parts.empty? ? prefix + title : field_title(resource_class, rest_field_parts.join('.'), prefix + title + ' ')
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
def _is_field_relation?(field_value)
|
29
|
-
field_value.is_a?(ActiveRecord::Associations::CollectionProxy)
|
30
|
-
end
|
31
|
-
|
32
|
-
def _parse_field_data(field_data)
|
33
|
-
custom_query = nil
|
34
|
-
custom_format = nil
|
35
|
-
|
36
|
-
if field_data.is_a?(Hash)
|
37
|
-
current_field = field_data.keys.first
|
38
|
-
rest_field_parts = field_data[current_field]
|
39
|
-
|
40
|
-
if rest_field_parts.is_a?(String)
|
41
|
-
rest_field_parts = Array(rest_field_parts)
|
42
|
-
else
|
43
|
-
custom_query = field_data[current_field][:query]
|
44
|
-
custom_format = field_data[current_field][:format]
|
45
|
-
rest_field_parts = []
|
46
|
-
end
|
47
|
-
else
|
48
|
-
current_field, *rest_field_parts = field_data.to_s.split('.')
|
49
|
-
end
|
50
|
-
|
51
|
-
return current_field, rest_field_parts, custom_query, custom_format
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
1
|
+
module Manage
|
2
|
+
module Fields
|
3
|
+
class Reader
|
4
|
+
class << self
|
5
|
+
def field_value(scope, field_data)
|
6
|
+
current_field, rest_field_parts, custom_query, custom_format = _parse_field_data(field_data)
|
7
|
+
value = scope.public_send(current_field)
|
8
|
+
|
9
|
+
if _is_field_relation?(value)
|
10
|
+
value = custom_query.present? ? custom_query.call(value) : value
|
11
|
+
|
12
|
+
value.map do |entity|
|
13
|
+
("<a href=\"#{current_field}/#{entity.id}\">#{custom_format.present? ? custom_format.call(entity) : entity.id }</a>")
|
14
|
+
end.join(', ').html_safe
|
15
|
+
else
|
16
|
+
rest_field_parts.empty? ? value : field_value(value, rest_field_parts.join('.'))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def field_title(resource_class, field_data, prefix='')
|
21
|
+
current_field, rest_field_parts = _parse_field_data(field_data)
|
22
|
+
title = resource_class.human_attribute_name(current_field)
|
23
|
+
|
24
|
+
rest_field_parts.empty? ? prefix + title : field_title(resource_class, rest_field_parts.join('.'), prefix + title + ' ')
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
def _is_field_relation?(field_value)
|
29
|
+
field_value.is_a?(ActiveRecord::Associations::CollectionProxy)
|
30
|
+
end
|
31
|
+
|
32
|
+
def _parse_field_data(field_data)
|
33
|
+
custom_query = nil
|
34
|
+
custom_format = nil
|
35
|
+
|
36
|
+
if field_data.is_a?(Hash)
|
37
|
+
current_field = field_data.keys.first
|
38
|
+
rest_field_parts = field_data[current_field]
|
39
|
+
|
40
|
+
if rest_field_parts.is_a?(String)
|
41
|
+
rest_field_parts = Array(rest_field_parts)
|
42
|
+
else
|
43
|
+
custom_query = field_data[current_field][:query]
|
44
|
+
custom_format = field_data[current_field][:format]
|
45
|
+
rest_field_parts = []
|
46
|
+
end
|
47
|
+
else
|
48
|
+
current_field, *rest_field_parts = field_data.to_s.split('.')
|
49
|
+
end
|
50
|
+
|
51
|
+
return current_field, rest_field_parts, custom_query, custom_format
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,51 +1,51 @@
|
|
1
|
-
module Manage
|
2
|
-
module Fields
|
3
|
-
class Searcher
|
4
|
-
class << self
|
5
|
-
def generate_search_object(resource_class, search_fields)
|
6
|
-
search_class = Class.new do
|
7
|
-
include SearchObject.module(:model, :sorting)
|
8
|
-
|
9
|
-
def escape_search_term(term)
|
10
|
-
"%#{term.gsub(/\s+/, '%')}%".downcase
|
11
|
-
end
|
12
|
-
|
13
|
-
def parse_date(date)
|
14
|
-
Date.strptime(date, '%Y-%m-%d') rescue nil
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
search_class.scope { resource_class.all }
|
20
|
-
Object.const_set("#{resource_class.name.gsub(/:/, '')}Searcher", search_class)
|
21
|
-
|
22
|
-
search_fields.select {|f| not f.to_s.include?('.')}.each do |field|
|
23
|
-
field_type = resource_class.columns_hash[field.to_s].type
|
24
|
-
case field_type
|
25
|
-
when *[:text, :string]
|
26
|
-
search_class.option field.to_sym do |scope, value|
|
27
|
-
value.blank? ? scope : scope.where("lower(#{field.to_s}) LIKE lower(?)", escape_search_term(value))
|
28
|
-
end
|
29
|
-
when :datetime
|
30
|
-
search_class.option field.to_sym do |scope, value|
|
31
|
-
date = parse_date value
|
32
|
-
scope.where("DATE(#{field.to_s}) >= ?", date) if date.present?
|
33
|
-
end
|
34
|
-
when :integer
|
35
|
-
search_class.option field.to_sym
|
36
|
-
when :boolean
|
37
|
-
search_class.option field.to_sym
|
38
|
-
else
|
39
|
-
search_class.option field.to_sym do |scope, value|
|
40
|
-
scope.where "#{field.to_s} = '?'", escape_search_term(value)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
search_class
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
1
|
+
module Manage
|
2
|
+
module Fields
|
3
|
+
class Searcher
|
4
|
+
class << self
|
5
|
+
def generate_search_object(resource_class, search_fields)
|
6
|
+
search_class = Class.new do
|
7
|
+
include SearchObject.module(:model, :sorting)
|
8
|
+
|
9
|
+
def escape_search_term(term)
|
10
|
+
"%#{term.gsub(/\s+/, '%')}%".downcase
|
11
|
+
end
|
12
|
+
|
13
|
+
def parse_date(date)
|
14
|
+
Date.strptime(date, '%Y-%m-%d') rescue nil
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
search_class.scope { resource_class.all }
|
20
|
+
Object.const_set("#{resource_class.name.gsub(/:/, '')}Searcher", search_class)
|
21
|
+
|
22
|
+
search_fields.select {|f| not f.to_s.include?('.')}.each do |field|
|
23
|
+
field_type = resource_class.columns_hash[field.to_s].type
|
24
|
+
case field_type
|
25
|
+
when *[:text, :string]
|
26
|
+
search_class.option field.to_sym do |scope, value|
|
27
|
+
value.blank? ? scope : scope.where("lower(#{field.to_s}) LIKE lower(?)", escape_search_term(value))
|
28
|
+
end
|
29
|
+
when :datetime
|
30
|
+
search_class.option field.to_sym do |scope, value|
|
31
|
+
date = parse_date value
|
32
|
+
scope.where("DATE(#{field.to_s}) >= ?", date) if date.present?
|
33
|
+
end
|
34
|
+
when :integer
|
35
|
+
search_class.option field.to_sym
|
36
|
+
when :boolean
|
37
|
+
search_class.option field.to_sym
|
38
|
+
else
|
39
|
+
search_class.option field.to_sym do |scope, value|
|
40
|
+
scope.where "#{field.to_s} = '?'", escape_search_term(value)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
search_class
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
data/lib/manage/version.rb
CHANGED
data/lib/tasks/manage_tasks.rake
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
# desc "Explaining what the task does"
|
2
|
-
# task :manage do
|
3
|
-
# # Task goes here
|
4
|
-
# end
|
5
|
-
|
6
|
-
namespace :manage do
|
7
|
-
desc "Create the initial admin user for the interface"
|
8
|
-
task :create_admin => :environment do
|
9
|
-
user = Manage::AdminUser.create!(
|
10
|
-
:email => "admin@admin.com",
|
11
|
-
:password => "11223344",
|
12
|
-
:password_confirmation => "11223344"
|
13
|
-
)
|
14
|
-
end
|
15
|
-
end
|
1
|
+
# desc "Explaining what the task does"
|
2
|
+
# task :manage do
|
3
|
+
# # Task goes here
|
4
|
+
# end
|
5
|
+
|
6
|
+
namespace :manage do
|
7
|
+
desc "Create the initial admin user for the interface"
|
8
|
+
task :create_admin => :environment do
|
9
|
+
user = Manage::AdminUser.create!(
|
10
|
+
:email => "admin@admin.com",
|
11
|
+
:password => "11223344",
|
12
|
+
:password_confirmation => "11223344"
|
13
|
+
)
|
14
|
+
end
|
15
|
+
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
-
<%%= f.error_notification %>
|
3
|
-
|
4
|
-
<div class="form-inputs">
|
5
|
-
<%- edit_attributes.each do |attribute| -%>
|
6
|
-
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
7
|
-
<%- end -%>
|
8
|
-
</div>
|
9
|
-
|
10
|
-
<div class="form-actions">
|
11
|
-
<%%= f.button :submit %>
|
12
|
-
</div>
|
13
|
-
<%% end %>
|
1
|
+
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
|
2
|
+
<%%= f.error_notification %>
|
3
|
+
|
4
|
+
<div class="form-inputs">
|
5
|
+
<%- edit_attributes.each do |attribute| -%>
|
6
|
+
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
|
7
|
+
<%- end -%>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="form-actions">
|
11
|
+
<%%= f.button :submit %>
|
12
|
+
</div>
|
13
|
+
<%% end %>
|