typus-rails4 4.0.0.beta6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +488 -0
- data/Gemfile +57 -0
- data/Gemfile.lock +253 -0
- data/MIT-LICENSE +20 -0
- data/README.md +101 -0
- data/Rakefile +51 -0
- data/app/assets/javascripts/typus/application.js +11 -0
- data/app/assets/javascripts/typus/custom.js +2 -0
- data/app/assets/javascripts/typus/jquery-2.1.1.min.js +4 -0
- data/app/assets/javascripts/typus/jquery.application.js +30 -0
- data/app/assets/stylesheets/typus/application.css +6 -0
- data/app/assets/stylesheets/typus/custom.scss +4 -0
- data/app/assets/stylesheets/typus/overrides.scss +10 -0
- data/app/assets/stylesheets/typus/signin.scss +45 -0
- data/app/controllers/admin/account_controller.rb +47 -0
- data/app/controllers/admin/base_controller.rb +40 -0
- data/app/controllers/admin/dashboard_controller.rb +6 -0
- data/app/controllers/admin/resource_controller.rb +8 -0
- data/app/controllers/admin/resources_controller.rb +268 -0
- data/app/controllers/admin/session_controller.rb +43 -0
- data/app/controllers/concerns/admin/actions.rb +88 -0
- data/app/controllers/concerns/admin/acts_as_list.rb +35 -0
- data/app/controllers/concerns/admin/ancestry.rb +26 -0
- data/app/controllers/concerns/admin/autocomplete.rb +11 -0
- data/app/controllers/concerns/admin/bulk.rb +76 -0
- data/app/controllers/concerns/admin/featured_image.rb +22 -0
- data/app/controllers/concerns/admin/filters.rb +57 -0
- data/app/controllers/concerns/admin/format.rb +49 -0
- data/app/controllers/concerns/admin/headless.rb +23 -0
- data/app/controllers/concerns/admin/hooks.rb +4 -0
- data/app/controllers/concerns/admin/multisite.rb +10 -0
- data/app/controllers/concerns/admin/navigation.rb +27 -0
- data/app/controllers/concerns/admin/trash.rb +65 -0
- data/app/helpers/admin/base_helper.rb +78 -0
- data/app/helpers/admin/resources/data_types/belongs_to_helper.rb +88 -0
- data/app/helpers/admin/resources/data_types/boolean_helper.rb +33 -0
- data/app/helpers/admin/resources/data_types/date_helper.rb +16 -0
- data/app/helpers/admin/resources/data_types/datetime_helper.rb +19 -0
- data/app/helpers/admin/resources/data_types/dragonfly_helper.rb +49 -0
- data/app/helpers/admin/resources/data_types/float_helper.rb +2 -0
- data/app/helpers/admin/resources/data_types/has_and_belongs_to_many_helper.rb +59 -0
- data/app/helpers/admin/resources/data_types/has_many_helper.rb +76 -0
- data/app/helpers/admin/resources/data_types/has_one_helper.rb +44 -0
- data/app/helpers/admin/resources/data_types/integer_helper.rb +13 -0
- data/app/helpers/admin/resources/data_types/paperclip_helper.rb +49 -0
- data/app/helpers/admin/resources/data_types/selector_helper.rb +11 -0
- data/app/helpers/admin/resources/data_types/string_helper.rb +38 -0
- data/app/helpers/admin/resources/data_types/text_helper.rb +6 -0
- data/app/helpers/admin/resources/data_types/transversal_helper.rb +8 -0
- data/app/helpers/admin/resources/data_types/tree_helper.rb +28 -0
- data/app/helpers/admin/resources/display_helper.rb +27 -0
- data/app/helpers/admin/resources/filters_helper.rb +18 -0
- data/app/helpers/admin/resources/form_helper.rb +85 -0
- data/app/helpers/admin/resources/list_helper.rb +31 -0
- data/app/helpers/admin/resources/pagination_helper.rb +28 -0
- data/app/helpers/admin/resources/relationships_helper.rb +33 -0
- data/app/helpers/admin/resources/sidebar_helper.rb +34 -0
- data/app/helpers/admin/resources/table_helper.rb +69 -0
- data/app/helpers/admin/resources_helper.rb +25 -0
- data/app/mailers/admin/mailer.rb +19 -0
- data/app/views/admin/account/_form.html.erb +17 -0
- data/app/views/admin/account/forgot_password.html.erb +16 -0
- data/app/views/admin/account/new.html.erb +10 -0
- data/app/views/admin/dashboard/_sidebar.html.erb +14 -0
- data/app/views/admin/dashboard/index.html.erb +8 -0
- data/app/views/admin/dashboard/styles.html.erb +153 -0
- data/app/views/admin/dashboard/widgets/_applications.html.erb +44 -0
- data/app/views/admin/dashboard/widgets/_default.html.erb +43 -0
- data/app/views/admin/dashboard/widgets/_models.html.erb +23 -0
- data/app/views/admin/dashboard/widgets/_models_extended.html.erb +25 -0
- data/app/views/admin/dashboard/widgets/_resources.html.erb +23 -0
- data/app/views/admin/dashboard/widgets/_users.html.erb +23 -0
- data/app/views/admin/mailer/reset_password_instructions.html.erb +7 -0
- data/app/views/admin/mailer/reset_password_instructions.text.erb +7 -0
- data/app/views/admin/resource/_sidebar.html.erb +14 -0
- data/app/views/admin/resources/_edit.html.erb +0 -0
- data/app/views/admin/resources/_form.html.erb +28 -0
- data/app/views/admin/resources/_form_javascripts.html.erb +0 -0
- data/app/views/admin/resources/_form_modal.html.erb +13 -0
- data/app/views/admin/resources/_index.html.erb +0 -0
- data/app/views/admin/resources/_new.html.erb +0 -0
- data/app/views/admin/resources/_pagination.html.erb +15 -0
- data/app/views/admin/resources/_show.html.erb +0 -0
- data/app/views/admin/resources/_sidebar.html.erb +1 -0
- data/app/views/admin/resources/destroy.html.erb +16 -0
- data/app/views/admin/resources/edit.html.erb +22 -0
- data/app/views/admin/resources/edit/_actions.html.erb +7 -0
- data/app/views/admin/resources/edit/_recently_edited.html.erb +8 -0
- data/app/views/admin/resources/index.html.erb +29 -0
- data/app/views/admin/resources/new.html.erb +20 -0
- data/app/views/admin/resources/show.html.erb +26 -0
- data/app/views/admin/session/new.html.erb +18 -0
- data/app/views/admin/shared/_head.html.erb +24 -0
- data/app/views/admin/shared/_modals.html.erb +3 -0
- data/app/views/admin/shared/_sidebar_placeholder.html.erb +0 -0
- data/app/views/admin/templates/README.md +5 -0
- data/app/views/admin/templates/_belongs_to.html.erb +8 -0
- data/app/views/admin/templates/_boolean.html.erb +7 -0
- data/app/views/admin/templates/_date.html.erb +6 -0
- data/app/views/admin/templates/_datetime.html.erb +8 -0
- data/app/views/admin/templates/_dragonfly.html.erb +6 -0
- data/app/views/admin/templates/_dragonfly_form_preview.html.erb +21 -0
- data/app/views/admin/templates/_dragonfly_preview.html.erb +12 -0
- data/app/views/admin/templates/_has_and_belongs_to_many.html.erb +21 -0
- data/app/views/admin/templates/_has_many.html.erb +18 -0
- data/app/views/admin/templates/_has_one.html.erb +14 -0
- data/app/views/admin/templates/_json.html.erb +11 -0
- data/app/views/admin/templates/_paperclip.html.erb +5 -0
- data/app/views/admin/templates/_paperclip_form_preview.html.erb +21 -0
- data/app/views/admin/templates/_paperclip_preview.html.erb +12 -0
- data/app/views/admin/templates/_password.html.erb +6 -0
- data/app/views/admin/templates/_position.html.erb +5 -0
- data/app/views/admin/templates/_profile_sidebar.html.erb +4 -0
- data/app/views/admin/templates/_selector.html.erb +4 -0
- data/app/views/admin/templates/_string.html.erb +4 -0
- data/app/views/admin/templates/_string_with_preview.html.erb +11 -0
- data/app/views/admin/templates/_text.html.erb +11 -0
- data/app/views/admin/templates/_text_with_ckeditor.html.erb +24 -0
- data/app/views/admin/templates/_text_with_ckeditor_and_assets.html.erb +38 -0
- data/app/views/admin/templates/_time.html.erb +9 -0
- data/app/views/admin/templates/_tree.html.erb +6 -0
- data/app/views/admin/templates/modals/_belongs_to.html.erb +60 -0
- data/app/views/admin/templates/modals/_dragonfly.html.erb +13 -0
- data/app/views/admin/templates/modals/_has_and_belongs_to_many.html.erb +25 -0
- data/app/views/admin/templates/modals/_has_many.html.erb +59 -0
- data/app/views/admin/templates/modals/_paperclip.html.erb +13 -0
- data/app/views/helpers/admin/base/_apps.html.erb +86 -0
- data/app/views/helpers/admin/base/_breadcrumbs.html.erb +6 -0
- data/app/views/helpers/admin/base/_flash_message.html.erb +3 -0
- data/app/views/helpers/admin/base/_login_info.html.erb +0 -0
- data/app/views/helpers/admin/dashboard/_resources.html.erb +19 -0
- data/app/views/helpers/admin/resources/_actions.html.erb +18 -0
- data/app/views/helpers/admin/resources/_errors.html.erb +12 -0
- data/app/views/helpers/admin/resources/_filters.html.erb +16 -0
- data/app/views/helpers/admin/resources/_search.html.erb +17 -0
- data/app/views/helpers/admin/resources/_sidebar.html.erb +4 -0
- data/app/views/helpers/admin/resources/_table.html.erb +45 -0
- data/app/views/helpers/admin/resources/sidebar/_item.html.erb +26 -0
- data/app/views/helpers/admin/resources/sidebar/_items.html.erb +14 -0
- data/app/views/helpers/admin/resources/sidebar/_items_index.html.erb +57 -0
- data/app/views/layouts/admin/base.html.erb +30 -0
- data/app/views/layouts/admin/headless.html.erb +1 -0
- data/app/views/layouts/admin/session.html.erb +26 -0
- data/bin/run-tests +7 -0
- data/bin/setup +9 -0
- data/config/locales/typus.en.yml +125 -0
- data/config/routes.rb +46 -0
- data/lib/generators/templates/config/initializers/typus.rb +34 -0
- data/lib/generators/templates/config/initializers/typus_authentication.rb +18 -0
- data/lib/generators/templates/config/initializers/typus_resources.rb +24 -0
- data/lib/generators/templates/config/typus/README +58 -0
- data/lib/generators/templates/config/typus/application.yml +3 -0
- data/lib/generators/templates/config/typus/application_roles.yml +4 -0
- data/lib/generators/templates/config/typus/typus.yml +15 -0
- data/lib/generators/templates/config/typus/typus_roles.yml +4 -0
- data/lib/generators/templates/controller.erb +2 -0
- data/lib/generators/templates/migration.erb +22 -0
- data/lib/generators/templates/view.html.erb +13 -0
- data/lib/generators/typus/config_generator.rb +67 -0
- data/lib/generators/typus/controller_generator.rb +26 -0
- data/lib/generators/typus/initializers_generator.rb +20 -0
- data/lib/generators/typus/migration_generator.rb +94 -0
- data/lib/generators/typus/model_generator.rb +93 -0
- data/lib/generators/typus/typus_generator.rb +54 -0
- data/lib/generators/typus/views_generator.rb +19 -0
- data/lib/support/active_record.rb +42 -0
- data/lib/support/fake_user.rb +47 -0
- data/lib/support/hash.rb +8 -0
- data/lib/support/object.rb +9 -0
- data/lib/support/string.rb +40 -0
- data/lib/tasks/typus.rake +11 -0
- data/lib/typus.rb +215 -0
- data/lib/typus/authentication/base.rb +39 -0
- data/lib/typus/authentication/devise.rb +19 -0
- data/lib/typus/authentication/http_basic.rb +18 -0
- data/lib/typus/authentication/none.rb +15 -0
- data/lib/typus/authentication/none_with_role.rb +15 -0
- data/lib/typus/authentication/session.rb +123 -0
- data/lib/typus/configuration.rb +43 -0
- data/lib/typus/engine.rb +4 -0
- data/lib/typus/orm/active_record.rb +10 -0
- data/lib/typus/orm/active_record/admin_user.rb +65 -0
- data/lib/typus/orm/active_record/class_methods.rb +104 -0
- data/lib/typus/orm/active_record/instance_methods.rb +76 -0
- data/lib/typus/orm/active_record/search.rb +43 -0
- data/lib/typus/orm/base/class_methods.rb +188 -0
- data/lib/typus/orm/base/search.rb +70 -0
- data/lib/typus/regex.rb +11 -0
- data/lib/typus/resources.rb +55 -0
- data/lib/typus/version.rb +10 -0
- data/typus.gemspec +27 -0
- data/vendor/assets/chosen/LICENSE.md +24 -0
- data/vendor/assets/chosen/chosen-sprite.png +0 -0
- data/vendor/assets/chosen/chosen-sprite@2x.png +0 -0
- data/vendor/assets/chosen/chosen.jquery.js +1239 -0
- data/vendor/assets/chosen/chosen.scss +437 -0
- metadata +271 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module Admin::Resources::PaginationHelper
|
|
2
|
+
|
|
3
|
+
def admin_paginate(resource = @resource)
|
|
4
|
+
params[:per_page] ||= resource.typus_options_for(:per_page)
|
|
5
|
+
params[:per_page] = params[:per_page].to_i
|
|
6
|
+
|
|
7
|
+
params[:offset] ||= 0
|
|
8
|
+
params[:offset] = params[:offset].to_i
|
|
9
|
+
|
|
10
|
+
next_offset = params[:offset] + params[:per_page]
|
|
11
|
+
previous_offset = params[:offset] - params[:per_page]
|
|
12
|
+
|
|
13
|
+
options = {}
|
|
14
|
+
|
|
15
|
+
current_page = (params[:offset].to_f / params[:per_page]) + 1
|
|
16
|
+
num_pages = (resource.count.to_f / params[:per_page]).ceil
|
|
17
|
+
unless current_page >= num_pages
|
|
18
|
+
options[:next] = params.merge(offset: next_offset)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
if previous_offset >= 0
|
|
22
|
+
options[:previous] = params.merge(offset: previous_offset)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
render 'admin/resources/pagination', { options: options }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module Admin::Resources::RelationshipsHelper
|
|
2
|
+
|
|
3
|
+
def setup_relationship(field)
|
|
4
|
+
@field = field
|
|
5
|
+
@model_to_relate = @resource.reflect_on_association(field.to_sym).class_name.constantize
|
|
6
|
+
@model_to_relate_as_resource = @model_to_relate.to_resource
|
|
7
|
+
@reflection = @resource.reflect_on_association(field.to_sym)
|
|
8
|
+
@association_name = @reflection.name.to_s
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def build_pagination
|
|
12
|
+
@data = @item.send(@field).order(@model_to_relate.typus_order_by).where(set_conditions)
|
|
13
|
+
items_per_page = @model_to_relate.typus_options_for(:per_page)
|
|
14
|
+
@items = @data.limit(items_per_page)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def build_relationship_table
|
|
18
|
+
build_list(@model_to_relate,
|
|
19
|
+
@model_to_relate.typus_fields_for(:relationship),
|
|
20
|
+
@items,
|
|
21
|
+
@model_to_relate_as_resource,
|
|
22
|
+
{},
|
|
23
|
+
@reflection.macro,
|
|
24
|
+
@association_name)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def set_conditions
|
|
28
|
+
if @model_to_relate.typus_options_for(:only_user_items) && admin_user.is_not_root?
|
|
29
|
+
{ Typus.user_foreign_key => admin_user }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Admin::Resources::SidebarHelper
|
|
2
|
+
|
|
3
|
+
def build_sidebar
|
|
4
|
+
locals = { sidebar_title: t('typus.dashboard.title'), actions: []}
|
|
5
|
+
|
|
6
|
+
if @resource
|
|
7
|
+
locals[:actions] = [sidebar_list(@resource.name), sidebar_add_new(@resource.name)].compact
|
|
8
|
+
locals[:sidebar_title] = @resource.model_name.human(count: 1_000)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
render 'helpers/admin/resources/sidebar', locals
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def sidebar_add_new(klass)
|
|
15
|
+
return if admin_user.cannot?('create', klass)
|
|
16
|
+
|
|
17
|
+
{
|
|
18
|
+
message: t('typus.buttons.add'),
|
|
19
|
+
url: { controller: "/admin/#{klass.to_resource}", action: 'new' },
|
|
20
|
+
icon: 'plus',
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def sidebar_list(klass)
|
|
25
|
+
return if admin_user.cannot?('read', klass)
|
|
26
|
+
|
|
27
|
+
{
|
|
28
|
+
message: t('typus.buttons.list'),
|
|
29
|
+
url: { controller: "/admin/#{klass.to_resource}", action: 'index' },
|
|
30
|
+
icon: 'list',
|
|
31
|
+
}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module Admin::Resources::TableHelper
|
|
2
|
+
|
|
3
|
+
def build_table(model, fields, items, link_options = {}, association = nil, association_name = nil)
|
|
4
|
+
locals = {
|
|
5
|
+
model: model,
|
|
6
|
+
fields: fields,
|
|
7
|
+
items: items,
|
|
8
|
+
link_options: link_options,
|
|
9
|
+
headers: table_header(model, fields),
|
|
10
|
+
association_name: association_name,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
render 'helpers/admin/resources/table', locals
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def table_header(model, fields, params = self.params)
|
|
17
|
+
fields.map do |key, _|
|
|
18
|
+
|
|
19
|
+
key = key.gsub('.', ' ') if key.to_s.match(/\./)
|
|
20
|
+
content = model.human_attribute_name(key)
|
|
21
|
+
|
|
22
|
+
if params[:action].eql?('index') && model.typus_options_for(:sortable)
|
|
23
|
+
association = model.reflect_on_association(key.to_sym)
|
|
24
|
+
order_by = association ? association.foreign_key : key
|
|
25
|
+
|
|
26
|
+
if (model.model_fields.map(&:first).map(&:to_s).include?(key) || model.reflect_on_all_associations(:belongs_to).map(&:name).include?(key.to_sym))
|
|
27
|
+
sort_order = case params[:sort_order]
|
|
28
|
+
when 'asc' then %w(desc dropup)
|
|
29
|
+
when 'desc' then %w(asc dropdown)
|
|
30
|
+
else [nil, nil]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
switch = "<span class='#{sort_order.last}'><span class='caret'></span></span>" if params[:order_by].eql?(order_by)
|
|
34
|
+
options = { order_by: order_by, sort_order: sort_order.first }
|
|
35
|
+
message = [content, switch].compact.join(' ').html_safe
|
|
36
|
+
content = link_to(message, params.merge(options))
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
content
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def table_fields_for_item(item, fields)
|
|
45
|
+
fields.map { |k, v| send("table_#{v}_field", k, item) }
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def table_actions(model, item)
|
|
49
|
+
@resource_actions.reject! do |_, url, _, _|
|
|
50
|
+
admin_user.cannot?(url[:action], model.name)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
@resource_actions.map do |body, url, options, proc|
|
|
54
|
+
next if proc && proc.respond_to?(:call) && proc.call(item) == false
|
|
55
|
+
|
|
56
|
+
# Hack to fix options URL
|
|
57
|
+
if options && options['data-toggle']
|
|
58
|
+
options[:url] = url_for(controller: "/admin/#{model.to_resource}", action: url[:action], id: item.id, _popup: true)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
{
|
|
62
|
+
message: t(body),
|
|
63
|
+
url: params.dup.cleanup.merge({controller: "/admin/#{model.to_resource}", id: item.id}).merge(url),
|
|
64
|
+
options: options,
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Admin::ResourcesHelper
|
|
2
|
+
|
|
3
|
+
def admin_search(resource = @resource, params = self.params)
|
|
4
|
+
if (typus_search = resource.typus_defaults_for(:search)) && typus_search.any?
|
|
5
|
+
|
|
6
|
+
hidden_filters = params.dup
|
|
7
|
+
rejections = %w(id controller action locale utf8 sort_order order_by search page subdomain)
|
|
8
|
+
hidden_filters.delete_if { |k, _| rejections.include?(k) }
|
|
9
|
+
|
|
10
|
+
render 'helpers/admin/resources/search', hidden_filters: hidden_filters
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def build_sidebar
|
|
15
|
+
app_name = @resource.typus_application
|
|
16
|
+
resources = admin_user.application(app_name).map(&:constantize).delete_if { |k| k.typus_options_for(:hide_from_sidebar) }
|
|
17
|
+
|
|
18
|
+
if resources.any?
|
|
19
|
+
render 'helpers/admin/resources/sidebar', resources: resources
|
|
20
|
+
else
|
|
21
|
+
render 'admin/dashboard/sidebar'
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class Admin::Mailer < ActionMailer::Base
|
|
2
|
+
|
|
3
|
+
def reset_password_instructions(user, host)
|
|
4
|
+
@user = user
|
|
5
|
+
@token_url = admin_account_url(user.token, host: host)
|
|
6
|
+
|
|
7
|
+
options = {
|
|
8
|
+
from: Typus.mailer_sender,
|
|
9
|
+
to: user.email,
|
|
10
|
+
subject: I18n.t('typus.emails.password_reset.title', admin_title: Typus.admin_title)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
mail(options) do |format|
|
|
14
|
+
format.text
|
|
15
|
+
format.html
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<h2 class="form-signin-heading">
|
|
2
|
+
<%= @page_title %>
|
|
3
|
+
</h2>
|
|
4
|
+
|
|
5
|
+
<%= admin_display_flash_message %>
|
|
6
|
+
|
|
7
|
+
<% label = Typus.user_class.human_attribute_name(:email) %>
|
|
8
|
+
<%= form.text_field :email, placeholder: label, class: 'form-control', autofocus: 'autofocus' %>
|
|
9
|
+
|
|
10
|
+
<% if controller.controller_name == 'session' %>
|
|
11
|
+
<% label = Typus.user_class.human_attribute_name(:password) %>
|
|
12
|
+
<%= form.password_field :password, placeholder: label, class: 'form-control' %>
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
15
|
+
<button class="btn btn-lg btn-primary btn-block" type="submit">
|
|
16
|
+
<%= t('.submit') %>
|
|
17
|
+
</button>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<%
|
|
2
|
+
@page_title = t('.title')
|
|
3
|
+
admin_title(@page_title)
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
<%= form_for Typus.user_class_as_symbol,
|
|
7
|
+
url: { action: :send_password },
|
|
8
|
+
html: { class: "form-signin" } do |form| %>
|
|
9
|
+
<%= render partial: "form", locals: { form: form } %>
|
|
10
|
+
<% end %>
|
|
11
|
+
|
|
12
|
+
<% content_for :actions do %>
|
|
13
|
+
<ul>
|
|
14
|
+
<li><%= link_to t('.remember_password'), new_admin_session_path %></li>
|
|
15
|
+
</ul>
|
|
16
|
+
<% end %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<h2>Welcome!</h2>
|
|
2
|
+
|
|
3
|
+
<%
|
|
4
|
+
issue = link_to('issue', 'https://github.com/typus/typus/issues')
|
|
5
|
+
user_guide = link_to('user guide', 'http://docs.typuscmf.com/')
|
|
6
|
+
%>
|
|
7
|
+
|
|
8
|
+
<p>Learn more about configuring the interface in the official <%= user_guide %>.</p>
|
|
9
|
+
|
|
10
|
+
<p>If you find a bug or think something in the documentation is
|
|
11
|
+
missing don't hesitate in opening an <%= issue %>.</p>
|
|
12
|
+
|
|
13
|
+
<p>Replace this sidebar by dropping a file named
|
|
14
|
+
<code>_sidebar.html.erb</code> on the <code>app/views/admin/dashboard</code> folder.</p>
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<div class="grid_2">
|
|
2
|
+
|
|
3
|
+
<h2>Header (h2) <small>Small <a href="#">link</a></small></h2>
|
|
4
|
+
|
|
5
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
6
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
7
|
+
quis <a href="#">nostrud exercitation</a> ullamco laboris nisi ut aliquip ex
|
|
8
|
+
ea commodo consequat.</p>
|
|
9
|
+
|
|
10
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
11
|
+
tempor incididunt ut labore</p>
|
|
12
|
+
|
|
13
|
+
<h3>Header (h3)</h3>
|
|
14
|
+
|
|
15
|
+
<ul>
|
|
16
|
+
<li>Lorem incididunt</li>
|
|
17
|
+
<li>Lorem incididunt</li>
|
|
18
|
+
<li>Lorem incididunt</li>
|
|
19
|
+
</ul>
|
|
20
|
+
|
|
21
|
+
<h3><a href="#">Header (h3)</a></h3>
|
|
22
|
+
|
|
23
|
+
<ul>
|
|
24
|
+
<li><a href="#">Lorem incididunt</a></li>
|
|
25
|
+
<li><a href="#">Lorem incididunt</a></li>
|
|
26
|
+
<li>Lorem incididunt</li>
|
|
27
|
+
</ul>
|
|
28
|
+
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div class="grid_10">
|
|
32
|
+
|
|
33
|
+
<h2>Header (h2) <small>Small <a href="#">link</a></small></h2>
|
|
34
|
+
|
|
35
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
36
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
37
|
+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
38
|
+
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
|
39
|
+
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
|
|
40
|
+
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
41
|
+
|
|
42
|
+
<blockquote>
|
|
43
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
44
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
45
|
+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
46
|
+
consequat.</p>
|
|
47
|
+
|
|
48
|
+
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
|
|
49
|
+
dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
|
|
50
|
+
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
51
|
+
</blockquote>
|
|
52
|
+
|
|
53
|
+
<pre>
|
|
54
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
55
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
56
|
+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
57
|
+
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
|
|
58
|
+
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
|
|
59
|
+
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
|
60
|
+
</pre>
|
|
61
|
+
|
|
62
|
+
<p>
|
|
63
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
64
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
65
|
+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
66
|
+
consequat.
|
|
67
|
+
</p>
|
|
68
|
+
|
|
69
|
+
<p><a href="#">Link to self</a></p>
|
|
70
|
+
|
|
71
|
+
<h3>Header (h3)</h3>
|
|
72
|
+
|
|
73
|
+
<p>
|
|
74
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
75
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
76
|
+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
77
|
+
consequat.
|
|
78
|
+
</p>
|
|
79
|
+
|
|
80
|
+
<h2>Boxes</h2>
|
|
81
|
+
|
|
82
|
+
<div class="box">
|
|
83
|
+
<p>
|
|
84
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
85
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
86
|
+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
87
|
+
consequat.
|
|
88
|
+
</p>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<div class="box">
|
|
92
|
+
<h3>Header (h3)</h3>
|
|
93
|
+
<ul>
|
|
94
|
+
<li>Lorem ipsum dolor sit amet</li>
|
|
95
|
+
<li>Duis aute irure dolor in reprehenderit in voluptate</li>
|
|
96
|
+
<li>Laboris nisi ut aliquip ex ea commodo</li>
|
|
97
|
+
</ul>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div class="box">
|
|
101
|
+
<h3>Header (h3)</h3>
|
|
102
|
+
<p>
|
|
103
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
104
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
105
|
+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
106
|
+
consequat.
|
|
107
|
+
</p>
|
|
108
|
+
<ul>
|
|
109
|
+
<li>Lorem ipsum dolor sit amet</li>
|
|
110
|
+
<li>Duis aute irure dolor in reprehenderit in voluptate</li>
|
|
111
|
+
<li>Laboris nisi ut aliquip ex ea commodo</li>
|
|
112
|
+
</ul>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<p>
|
|
116
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
|
|
117
|
+
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
|
|
118
|
+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
|
|
119
|
+
consequat.
|
|
120
|
+
</p>
|
|
121
|
+
|
|
122
|
+
<h2>Error Messages (h2)</h2>
|
|
123
|
+
|
|
124
|
+
<div id="flash" class="notice">
|
|
125
|
+
<strong>Hey!</strong> Sample ui-state-highlight style.
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
<div id="flash" class="alert">
|
|
129
|
+
<strong>Alert:</strong> Sample ui-state-error style.
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<h2>Filters (h2)</h2>
|
|
133
|
+
|
|
134
|
+
<h3>Filters with a list inside (h3)</h3>
|
|
135
|
+
|
|
136
|
+
<div class="filters">
|
|
137
|
+
<ul>
|
|
138
|
+
<li>Filter</li>
|
|
139
|
+
<li>Filter</li>
|
|
140
|
+
</ul>
|
|
141
|
+
</div>
|
|
142
|
+
|
|
143
|
+
<h3>Filters with a paragraph inside (h3)</h3>
|
|
144
|
+
|
|
145
|
+
<div class="filters">
|
|
146
|
+
<p>This is a paragraph.</p>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
<h2>Forms (h2)</h2>
|
|
150
|
+
|
|
151
|
+
<p>This is how a form looks like.</p>
|
|
152
|
+
|
|
153
|
+
</div>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<%
|
|
2
|
+
applications = admin_user.applications
|
|
3
|
+
|
|
4
|
+
if params[:application]
|
|
5
|
+
applications.reject! { |a| a.parameterize != params[:application] }
|
|
6
|
+
end
|
|
7
|
+
%>
|
|
8
|
+
|
|
9
|
+
<h2><%= t("Dashboard") %></h2>
|
|
10
|
+
|
|
11
|
+
<div class="row">
|
|
12
|
+
|
|
13
|
+
<% if applications.any? %>
|
|
14
|
+
<% applications.each do |app| %>
|
|
15
|
+
<div class="span3">
|
|
16
|
+
<div class="well">
|
|
17
|
+
<table class="table">
|
|
18
|
+
|
|
19
|
+
<thead>
|
|
20
|
+
<tr>
|
|
21
|
+
<th><%= t(app) %></th>
|
|
22
|
+
</tr>
|
|
23
|
+
</thead>
|
|
24
|
+
|
|
25
|
+
<% admin_user.application(app).map(&:constantize).each do |klass| %>
|
|
26
|
+
<% unless klass.typus_options_for(:hide_from_dashboard) %>
|
|
27
|
+
<tr>
|
|
28
|
+
<td>
|
|
29
|
+
<%= link_to klass.model_name.human(count: 1_000), controller: "/admin/#{klass.to_resource}" %>
|
|
30
|
+
</td>
|
|
31
|
+
</tr>
|
|
32
|
+
<% end %>
|
|
33
|
+
<% end %>
|
|
34
|
+
|
|
35
|
+
</table>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<% end %>
|
|
39
|
+
<% else %>
|
|
40
|
+
<div class="notice">
|
|
41
|
+
<%= t('typus.dashboard.no_applications') %>
|
|
42
|
+
</div>
|
|
43
|
+
<% end %>
|
|
44
|
+
</div>
|