bhf 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -0
- data/app/controllers/bhf/application_controller.rb +77 -0
- data/app/controllers/bhf/entries_controller.rb +123 -0
- data/app/controllers/bhf/pages_controller.rb +49 -0
- data/app/helpers/bhf/application_helper.rb +22 -0
- data/app/helpers/bhf/entries_helper.rb +16 -0
- data/app/helpers/bhf/pages_helper.rb +30 -0
- data/app/views/bhf/_footer.haml +11 -0
- data/app/views/bhf/application/index.haml +3 -0
- data/app/views/bhf/entries/_form.haml +14 -0
- data/app/views/bhf/entries/_validation_errors.haml +5 -0
- data/app/views/bhf/entries/edit.haml +2 -0
- data/app/views/bhf/entries/form/belongs_to/_radio.haml +7 -0
- data/app/views/bhf/entries/form/belongs_to/_select.haml +6 -0
- data/app/views/bhf/entries/form/belongs_to/_static.haml +9 -0
- data/app/views/bhf/entries/form/column/_boolean.haml +2 -0
- data/app/views/bhf/entries/form/column/_date.haml +2 -0
- data/app/views/bhf/entries/form/column/_file.haml +2 -0
- data/app/views/bhf/entries/form/column/_markdown.haml +3 -0
- data/app/views/bhf/entries/form/column/_number.haml +2 -0
- data/app/views/bhf/entries/form/column/_static.haml +8 -0
- data/app/views/bhf/entries/form/column/_string.haml +2 -0
- data/app/views/bhf/entries/form/column/_text.haml +2 -0
- data/app/views/bhf/entries/form/column/_wysiwyg.haml +3 -0
- data/app/views/bhf/entries/form/has_and_belongs_to_many/_check_box.haml +4 -0
- data/app/views/bhf/entries/form/has_and_belongs_to_many/_static.haml +12 -0
- data/app/views/bhf/entries/form/has_many/_static.haml +12 -0
- data/app/views/bhf/entries/form/has_one/_static.haml +9 -0
- data/app/views/bhf/entries/new.haml +2 -0
- data/app/views/bhf/helper/_field_errors.haml +4 -0
- data/app/views/bhf/helper/_flash.haml +4 -0
- data/app/views/bhf/helper/_info.haml +2 -0
- data/app/views/bhf/helper/_node.haml +6 -0
- data/app/views/bhf/helper/_reflection_node.haml +7 -0
- data/app/views/bhf/pages/_platform.haml +41 -0
- data/app/views/bhf/pages/macro/belongs_to/_default.haml +2 -0
- data/app/views/bhf/pages/macro/column/_boolean.haml +1 -0
- data/app/views/bhf/pages/macro/column/_date.haml +1 -0
- data/app/views/bhf/pages/macro/column/_number.haml +1 -0
- data/app/views/bhf/pages/macro/column/_primary_key.haml +1 -0
- data/app/views/bhf/pages/macro/column/_string.haml +1 -0
- data/app/views/bhf/pages/macro/column/_text.haml +1 -0
- data/app/views/bhf/pages/macro/has_and_belongs_to_many/_default.haml +2 -0
- data/app/views/bhf/pages/macro/has_many/_default.haml +2 -0
- data/app/views/bhf/pages/macro/has_one/_default.haml +2 -0
- data/app/views/bhf/pages/show.haml +3 -0
- data/app/views/layouts/bhf/default.haml +27 -0
- data/app/views/layouts/bhf/quick_edit.haml +5 -0
- data/config/locales/en.yml +56 -0
- data/config/routes.rb +14 -0
- data/lib/bhf/active_record.rb +18 -0
- data/lib/bhf/data.rb +127 -0
- data/lib/bhf/form.rb +35 -0
- data/lib/bhf/pagination.rb +111 -0
- data/lib/bhf/platform.rb +202 -0
- data/lib/bhf/settings.rb +40 -0
- data/lib/bhf.rb +13 -0
- data/lib/engine.rb +19 -0
- data/lib/rails/generators/bhf/templates/initializer.rb +9 -0
- data/public/javascripts/bhf.js +0 -0
- data/public/stylesheets/bhf.css +1 -0
- data/test/test_helper.rb +55 -0
- metadata +169 -0
data/README.md
ADDED
File without changes
|
@@ -0,0 +1,77 @@
|
|
1
|
+
class Bhf::ApplicationController < ActionController::Base
|
2
|
+
|
3
|
+
protect_from_forgery
|
4
|
+
|
5
|
+
before_filter :init_time, :check_admin_account, :load_config, :set_title
|
6
|
+
|
7
|
+
helper_method :entry_path, :new_entry_path, :entries_path, :edit_entry_path
|
8
|
+
layout 'bhf/default'
|
9
|
+
|
10
|
+
def index
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def check_admin_account
|
18
|
+
auth_logic = Bhf::Engine.config.auth_logic_from.constantize.new
|
19
|
+
|
20
|
+
if auth_logic.respond_to?(:current_admin_account) && auth_logic.current_admin_account
|
21
|
+
return true
|
22
|
+
else
|
23
|
+
redirect_to(root_url, :error => I18t.t('bhf.helpers.login.error')) and return false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def load_config
|
28
|
+
@config = Bhf::Settings.new(
|
29
|
+
YAML::load(IO.read('config/bhf.yml'))
|
30
|
+
# Bhf::Engine.config.bhf_logic
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def new_entry_path(platform, extra_params = {})
|
36
|
+
new_bhf_entry_path platform, extra_params
|
37
|
+
end
|
38
|
+
|
39
|
+
def entries_path(platform, extra_params = {})
|
40
|
+
bhf_entries_path platform, extra_params
|
41
|
+
end
|
42
|
+
|
43
|
+
def entry_path(platform, object, extra_params = {})
|
44
|
+
bhf_entry_path platform, object, extra_params
|
45
|
+
end
|
46
|
+
|
47
|
+
def edit_entry_path(platform, object, extra_params = {})
|
48
|
+
edit_bhf_entry_path platform, object, extra_params
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def set_title
|
53
|
+
@title = Bhf::Engine.config.page_title ||
|
54
|
+
Rails.application.class.to_s.split('::').first+' — Admin'
|
55
|
+
end
|
56
|
+
|
57
|
+
def set_message(type, model = nil)
|
58
|
+
key = model && ActiveModel::Naming.singular(model)
|
59
|
+
|
60
|
+
I18n.t("bhf.activerecord.notices.models.#{key}.#{type}", :model => model.model_name.human, :default => I18n.t("activerecord.notices.messages.#{type}"))
|
61
|
+
end
|
62
|
+
|
63
|
+
def init_time
|
64
|
+
@start_time = Time.now
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
def store_location
|
69
|
+
session[:return_to] = request.fullpath
|
70
|
+
end
|
71
|
+
|
72
|
+
def redirect_back_or_default(default, msg)
|
73
|
+
redirect_to(session[:return_to] || default, msg)
|
74
|
+
session[:return_to] = nil
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
class Bhf::EntriesController < Bhf::ApplicationController
|
2
|
+
before_filter :load_platform, :load_model, :set_page, :set_quick_edit
|
3
|
+
before_filter :load_object, :except => [:create, :new]
|
4
|
+
|
5
|
+
def new
|
6
|
+
@object = @model.new
|
7
|
+
after_load
|
8
|
+
|
9
|
+
@form_url = entries_path(@platform.name, @model)
|
10
|
+
end
|
11
|
+
|
12
|
+
def edit
|
13
|
+
@form_url = entry_path(@platform.name, @object)
|
14
|
+
|
15
|
+
if @quick_edit
|
16
|
+
render :layout => 'bhf/quick_edit'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def create
|
21
|
+
@object = @model.new(params[@model_sym])
|
22
|
+
after_load
|
23
|
+
|
24
|
+
before_save
|
25
|
+
if @object.save
|
26
|
+
manage_many_to_many
|
27
|
+
after_save
|
28
|
+
|
29
|
+
redirect_back_or_default(entry_path(@platform.name, @object), :notice => set_message('create.success', @model))
|
30
|
+
else
|
31
|
+
@form_url = entries_path(@platform.name, @model)
|
32
|
+
render :new
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def update
|
37
|
+
before_save
|
38
|
+
|
39
|
+
if @object.update_attributes(params[@model_sym])
|
40
|
+
manage_many_to_many
|
41
|
+
after_save
|
42
|
+
|
43
|
+
if @quick_edit
|
44
|
+
render :json => object_to_bhf_display_hash, :status => :ok
|
45
|
+
else
|
46
|
+
redirect_back_or_default(entry_path(@platform.name, @object), :notice => set_message('update.success', @model))
|
47
|
+
end
|
48
|
+
else
|
49
|
+
@form_url = entry_path(@platform.name, @object)
|
50
|
+
|
51
|
+
if @quick_edit
|
52
|
+
render :edit, :status => :unprocessable_entity, :layout => 'bhf/quick_edit'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def destroy
|
58
|
+
@object.destroy
|
59
|
+
redirect_back_or_default(bhf_root_url, :notice => set_message('destory.success', @model))
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def object_to_bhf_display_hash
|
65
|
+
@platform.columns.each_with_object({:to_bhf_s => @object.to_bhf_s}) do |column, hash|
|
66
|
+
unless column.field.macro == :column && @object.send(column.name).blank?
|
67
|
+
p = "bhf/pages/macro/#{column.field.macro}/#{column.field.display_type}"
|
68
|
+
hash[column.name] = render_to_string :partial => p, :locals => {:column => column, :object => @object}
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def load_platform
|
74
|
+
@platform = @config.find_platform(params[:platform])
|
75
|
+
end
|
76
|
+
|
77
|
+
def load_model
|
78
|
+
@model = @platform.model
|
79
|
+
@model_sym = ActiveModel::Naming.singular(@model).to_sym
|
80
|
+
end
|
81
|
+
|
82
|
+
def load_object
|
83
|
+
@object = @model.find(params[:id])
|
84
|
+
after_load
|
85
|
+
end
|
86
|
+
|
87
|
+
def manage_many_to_many
|
88
|
+
return unless params[:has_and_belongs_to_many]
|
89
|
+
params[:has_and_belongs_to_many].each_pair do |relation, ids|
|
90
|
+
reflection = @model.reflections[relation.to_sym]
|
91
|
+
|
92
|
+
@object.send(reflection.name).delete_all
|
93
|
+
|
94
|
+
ids = ids.values.reject(&:blank?)
|
95
|
+
|
96
|
+
return if ids.blank?
|
97
|
+
|
98
|
+
reflection.klass.find(ids).each do |relation_obj|
|
99
|
+
@object.send(relation) << relation_obj
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def after_load
|
105
|
+
@object.send(@platform.hooks(:after_load)) if @platform.hooks(:after_load)
|
106
|
+
end
|
107
|
+
|
108
|
+
def before_save
|
109
|
+
@object.send(@platform.hooks(:before_save), params) if @platform.hooks(:before_save)
|
110
|
+
end
|
111
|
+
|
112
|
+
def after_save
|
113
|
+
@object.send(@platform.hooks(:after_save), params) if @platform.hooks(:after_save)
|
114
|
+
end
|
115
|
+
|
116
|
+
def set_page
|
117
|
+
@page = @platform.page_name
|
118
|
+
end
|
119
|
+
|
120
|
+
def set_quick_edit
|
121
|
+
@quick_edit = request.xhr?
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class Bhf::PagesController < Bhf::ApplicationController
|
2
|
+
before_filter :set_page, :store_location
|
3
|
+
|
4
|
+
def show
|
5
|
+
platform_options = @config.content_for_page(@page)
|
6
|
+
|
7
|
+
@pagination = Bhf::Pagination.new(2, 3)
|
8
|
+
|
9
|
+
if request.xhr?
|
10
|
+
params.each do |key, value|
|
11
|
+
return render_platform(key) if value.is_a?(Hash)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
@platforms = platform_options.each_with_object([]) do |opts, obj|
|
16
|
+
platform = Bhf::Platform.new(opts, @page)
|
17
|
+
platform.paginated_objects = paginate_platform_objects(platform)
|
18
|
+
obj << platform
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def render_platform(platform_name)
|
25
|
+
@platform = @config.find_platform(platform_name)
|
26
|
+
|
27
|
+
@platform.paginated_objects = paginate_platform_objects(@platform)
|
28
|
+
|
29
|
+
render '_platform', :layout => false
|
30
|
+
end
|
31
|
+
|
32
|
+
def set_page
|
33
|
+
@page = params[:page]
|
34
|
+
end
|
35
|
+
|
36
|
+
def check_params(platform)
|
37
|
+
page = 1
|
38
|
+
page = params[platform][:page].to_i if params[platform] && !params[platform][:page].blank?
|
39
|
+
per_page = @pagination.offset_per_page
|
40
|
+
per_page = params[platform][:per_page].to_i if params[platform] && !params[platform][:per_page].blank?
|
41
|
+
|
42
|
+
return :page => page, :per_page => per_page
|
43
|
+
end
|
44
|
+
|
45
|
+
def paginate_platform_objects(platform)
|
46
|
+
platform.prepare_objects(params[platform.name] || {}).paginate(check_params(platform.name))
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Bhf
|
2
|
+
module ApplicationHelper
|
3
|
+
|
4
|
+
|
5
|
+
def new_t(platform)
|
6
|
+
t("bhf.helpers.entry.models.#{platform.model_name}.new", :platform_name => platform.title.singularize, :default => t('bhf.helpers.entry.new'))
|
7
|
+
end
|
8
|
+
|
9
|
+
def edit_t(platform)
|
10
|
+
t("bhf.helpers.entry.models.#{platform.model_name}.edit", :platform_name => platform.title.singularize, :default => t('bhf.helpers.entry.edit'))
|
11
|
+
end
|
12
|
+
|
13
|
+
def delete_t(platform)
|
14
|
+
t("bhf.helpers.entry.models.#{platform.model_name}.delete", :platform_name => platform.title.singularize, :default => t('bhf.helpers.entry.delete'))
|
15
|
+
end
|
16
|
+
|
17
|
+
def current_path(overwrite = {})
|
18
|
+
url_for params.merge(overwrite.merge(:only_path => true))
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Bhf
|
2
|
+
module EntriesHelper
|
3
|
+
|
4
|
+
def node(f, field, &block)
|
5
|
+
render :partial => 'bhf/helper/node', :locals => {:f => f, :field => field, :input => with_output_buffer(&block)}
|
6
|
+
end
|
7
|
+
|
8
|
+
def reflection_node(f, field, &block)
|
9
|
+
return if field.form_type === :static && f.object.new_record? && f.object.send(field.reflection.name).blank?
|
10
|
+
render :partial => 'bhf/helper/reflection_node', :locals => {
|
11
|
+
:f => f, :field => field, :input => with_output_buffer(&block)
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Bhf
|
2
|
+
module PagesHelper
|
3
|
+
|
4
|
+
def get_value(key, platform_name)
|
5
|
+
params[platform_name][key] if params[platform_name] && params[platform_name][key]
|
6
|
+
end
|
7
|
+
|
8
|
+
def current_order_path(order_by, platform_name)
|
9
|
+
params_platfrom = params[platform_name] ? params[platform_name].clone : {}
|
10
|
+
|
11
|
+
if params_platfrom['order'] === order_by && params_platfrom['direction'] != 'desc'
|
12
|
+
params_platfrom['direction'] = 'desc'
|
13
|
+
else
|
14
|
+
params_platfrom['direction'] = 'asc'
|
15
|
+
end
|
16
|
+
|
17
|
+
params_platfrom['order'] = order_by
|
18
|
+
|
19
|
+
url_for platform_name => params_platfrom
|
20
|
+
end
|
21
|
+
|
22
|
+
def order_class(order_by, platform_name)
|
23
|
+
params_platfrom = params[platform_name] ? params[platform_name] : {}
|
24
|
+
return unless params_platfrom['order'] === order_by
|
25
|
+
|
26
|
+
params_platfrom['direction'] === 'desc' ? 'sorted desc' : 'sorted asc'
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%p.stats= "Page rendered in ~#{(Time.now-@start_time).round(2)} seconds"
|
2
|
+
%p.copy
|
3
|
+
Made by
|
4
|
+
= link_to '@antpaw', 'http://twitter.com/antpaw'
|
5
|
+
with
|
6
|
+
= link_to 'Rails 3', 'http://twitter.com/antpaw'
|
7
|
+
and
|
8
|
+
= link_to 'MooTools', 'http://mootools.net/'
|
9
|
+
%p.info
|
10
|
+
More information on
|
11
|
+
= link_to 'GitHub', 'http://github.com/antpaw/bahnhof/'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
- html = { :id => (:main_form unless @quick_edit), :multipart => @platform.has_file_upload? }
|
2
|
+
= form_for @object, :url => @form_url, :builder => Bhf::Form::Builder, :html => html do |f|
|
3
|
+
|
4
|
+
- if f.object.errors.any?
|
5
|
+
= render :partial => 'validation_errors', :locals => {:f => f}
|
6
|
+
|
7
|
+
- @platform.fields.each do |field|
|
8
|
+
- unless field.form_type === :hidden
|
9
|
+
= render :partial => "bhf/entries/form/#{field.macro}/#{field.form_type}", :locals => {:f => f, :field => field}
|
10
|
+
|
11
|
+
- unless @quick_edit
|
12
|
+
.node
|
13
|
+
.label
|
14
|
+
.input= f.submit f.object.new_record? ? new_t(@platform) : edit_t(@platform)
|
@@ -0,0 +1,6 @@
|
|
1
|
+
- fk = field.reflection.association_foreign_key
|
2
|
+
.node
|
3
|
+
.label= f.label fk
|
4
|
+
.input
|
5
|
+
= f.select fk, options_from_collection_for_select(field.reflection.klass.all, :id, :to_bhf_s, f.object.send(fk))
|
6
|
+
= render :partial => 'bhf/helper/field_errors', :locals => {:f => f, :field => fk}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
= reflection_node f, field do
|
2
|
+
- ref_object = f.object.send(field.reflection.name)
|
3
|
+
- if ref_object.blank?
|
4
|
+
= t 'bhf.helpers.entry.empty'
|
5
|
+
- else
|
6
|
+
- if field.link
|
7
|
+
= link_to ref_object.to_bhf_s, edit_entry_path(field.link, ref_object), :class => 'quick_edit'
|
8
|
+
- else
|
9
|
+
= ref_object.to_bhf_s
|
@@ -0,0 +1,12 @@
|
|
1
|
+
= reflection_node f, field do
|
2
|
+
- ref_objects = f.object.send(field.reflection.name)
|
3
|
+
- if ref_objects.blank?
|
4
|
+
= t 'bhf.helpers.entries.empty'
|
5
|
+
- else
|
6
|
+
%ul
|
7
|
+
- ref_objects.each do |ref_object|
|
8
|
+
%li
|
9
|
+
- if field.link
|
10
|
+
= link_to ref_object.to_bhf_s, edit_entry_path(field.link, ref_object), :class => 'quick_edit'
|
11
|
+
- else
|
12
|
+
= ref_object.to_bhf_s
|
@@ -0,0 +1,12 @@
|
|
1
|
+
= reflection_node f, field do
|
2
|
+
- ref_objects = f.object.send(field.reflection.name)
|
3
|
+
- if ref_objects.blank?
|
4
|
+
= t 'bhf.helpers.entries.empty'
|
5
|
+
- else
|
6
|
+
%ul
|
7
|
+
- ref_objects.each do |ref_object|
|
8
|
+
%li
|
9
|
+
- if field.link
|
10
|
+
= link_to ref_object.to_bhf_s, edit_entry_path(field.link, ref_object), :class => 'quick_edit'
|
11
|
+
- else
|
12
|
+
= ref_object.to_bhf_s
|
@@ -0,0 +1,9 @@
|
|
1
|
+
= reflection_node f, field do
|
2
|
+
- ref_object = f.object.send(field.reflection.name)
|
3
|
+
- if ref_object.blank?
|
4
|
+
= t 'bhf.helpers.entry.empty'
|
5
|
+
- else
|
6
|
+
- if field.link
|
7
|
+
= link_to ref_object.to_bhf_s, edit_entry_path(field.link, ref_object), :class => 'quick_edit'
|
8
|
+
- else
|
9
|
+
= ref_object.to_bhf_s
|
@@ -0,0 +1,7 @@
|
|
1
|
+
.node
|
2
|
+
.label
|
3
|
+
%p= f.object.class.human_attribute_name(field.reflection.name)
|
4
|
+
.input
|
5
|
+
= input
|
6
|
+
= render :partial => 'bhf/helper/field_errors', :locals => {:f => f, :field => field.reflection.name}
|
7
|
+
= render :partial => 'bhf/helper/info', :locals => {:info => field.info}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
- @pagination.template = self
|
2
|
+
%table{:class => (@platform.custom_columns? ? 'custom_columns' : 'default_columns')}
|
3
|
+
%caption
|
4
|
+
%h4= @platform.title
|
5
|
+
%p.info= @pagination.info @platform, :entry_name => 'entry'
|
6
|
+
|
7
|
+
- if @platform.search?
|
8
|
+
= form_for @platform.name, :html => {:method => 'get', :class => 'search'} do |f|
|
9
|
+
= f.text_field :search, :value => get_value(:search, @platform.name), :placeholder => t('bhf.helpers.searchform.placeholder')
|
10
|
+
= f.hidden_field :per_page, :value => get_value(:per_page, @platform.name)
|
11
|
+
= f.hidden_field :order, :value => get_value(:order, @platform.name)
|
12
|
+
= f.hidden_field :direction, :value => get_value(:direction, @platform.name)
|
13
|
+
|
14
|
+
%p.create= link_to new_t(@platform), new_entry_path(@platform.name), :class => 'alt_button'
|
15
|
+
|
16
|
+
%thead
|
17
|
+
%tr
|
18
|
+
- @platform.columns.each do |column|
|
19
|
+
%th{:class => "#{column.field.macro} #{column.field.display_type} #{order_class(column.name, @platform.name)}"}
|
20
|
+
- column_name = @platform.model.human_attribute_name(column.name)
|
21
|
+
- link = link_to column_name, current_order_path(column.name, @platform.name)
|
22
|
+
= column.field.macro == :column ? link : column_name
|
23
|
+
|
24
|
+
%th.action
|
25
|
+
%tfoot
|
26
|
+
%tr
|
27
|
+
%td{:colspan => @platform.columns.count+1}
|
28
|
+
= @pagination.paginate @platform
|
29
|
+
%tbody
|
30
|
+
- @platform.paginated_objects.each do |object|
|
31
|
+
- edit_link = edit_entry_path(@platform.name, object)
|
32
|
+
%tr
|
33
|
+
- @platform.columns.each do |column|
|
34
|
+
%td{:class => "#{column.field.macro} #{column.field.display_type}", :'data-column-name' => column.name}
|
35
|
+
- unless column.field.macro == :column && object.send(column.name).blank?
|
36
|
+
= link_to edit_link, :class => 'quick_edit' do
|
37
|
+
- p = "bhf/pages/macro/#{column.field.macro}/#{column.field.display_type}"
|
38
|
+
= render :partial => p, :locals => {:column => column, :object => object}
|
39
|
+
%td.action
|
40
|
+
= link_to edit_t(@platform), edit_link, :class => 'edit'
|
41
|
+
= link_to delete_t(@platform), entry_path(@platform.name, object), :method => :delete, :confirm => t('bhf.helpers.promts.confirm'), :remote => true, :class => 'delete'
|
@@ -0,0 +1 @@
|
|
1
|
+
= object.send(column.name)
|
@@ -0,0 +1 @@
|
|
1
|
+
= l(object.send(column.name), :format => :short)
|
@@ -0,0 +1 @@
|
|
1
|
+
= object.send(column.name)
|
@@ -0,0 +1 @@
|
|
1
|
+
%strong= object.send(column.name)
|
@@ -0,0 +1 @@
|
|
1
|
+
= object.send(column.name)
|
@@ -0,0 +1 @@
|
|
1
|
+
= object.send(column.name)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
!!!
|
2
|
+
%html{:lang => I18n.locale}
|
3
|
+
%head
|
4
|
+
%meta{:charset => 'utf-8'}
|
5
|
+
%title= @title
|
6
|
+
= csrf_meta_tag
|
7
|
+
%link{:href => '/favicon.ico', :rel => 'icon', :type => 'image/x-icon'}
|
8
|
+
= stylesheet_link_tag 'bhf'
|
9
|
+
=# javascript_include_tag 'bhf'
|
10
|
+
= javascript_include_tag 'mootools-core-1.3-full-nocompat-yc.js', 'mootools-more', 'mootools_rails_driver-0.4.1.js', 'class/BrowserUpdate', 'class/Ajaxify', 'class/AjaxEdit', 'bhf_application'
|
11
|
+
|
12
|
+
%body
|
13
|
+
%header
|
14
|
+
%h1= @title
|
15
|
+
%nav
|
16
|
+
%ul
|
17
|
+
- @config.pages.each do |page|
|
18
|
+
%li{:class => ('active' if @page == page)}
|
19
|
+
= link_to page, bhf_page_path(page)
|
20
|
+
|
21
|
+
#content
|
22
|
+
#main
|
23
|
+
= render :partial => 'bhf/helper/flash', :locals => {:flash => flash}
|
24
|
+
= yield
|
25
|
+
|
26
|
+
%footer= render 'bhf/footer'
|
27
|
+
|