mega_bar 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +31 -0
  4. data/Rakefile +23 -0
  5. data/app/assets/javascripts/mega_bar/application.js +13 -0
  6. data/app/assets/stylesheets/mega_bar/application.css +15 -0
  7. data/app/controllers/mega_bar/application_controller.rb +28 -0
  8. data/app/controllers/mega_bar/checkboxes_controller.rb +19 -0
  9. data/app/controllers/mega_bar/field_displays_controller.rb +11 -0
  10. data/app/controllers/mega_bar/fields_controller.rb +11 -0
  11. data/app/controllers/mega_bar/grid_html.rb +27 -0
  12. data/app/controllers/mega_bar/mega_bar_concern.rb +169 -0
  13. data/app/controllers/mega_bar/model_displays_controller.rb +11 -0
  14. data/app/controllers/mega_bar/models_controller.rb +14 -0
  15. data/app/controllers/mega_bar/profile_table.rb +27 -0
  16. data/app/controllers/mega_bar/radio_buttons_controller.rb +18 -0
  17. data/app/controllers/mega_bar/records_formats_controller.rb +10 -0
  18. data/app/controllers/mega_bar/selects_controller.rb +12 -0
  19. data/app/controllers/mega_bar/testers_controller.rb +11 -0
  20. data/app/controllers/mega_bar/tests_controller.rb +5 -0
  21. data/app/controllers/mega_bar/textboxes_controller.rb +11 -0
  22. data/app/controllers/mega_bar/textreads_controller.rb +10 -0
  23. data/app/controllers/mega_bar/tmp_field_displays_controller.rb +18 -0
  24. data/app/controllers/mega_bar/tmp_fields_controller.rb +18 -0
  25. data/app/controllers/mega_bar/tmp_model_displays_controller.rb +18 -0
  26. data/app/controllers/mega_bar/tmp_models_controller.rb +16 -0
  27. data/app/controllers/mega_bar/tmp_records_formats_controller.rb +18 -0
  28. data/app/controllers/mega_bar/tmp_selects_controller.rb +18 -0
  29. data/app/controllers/mega_bar/tmp_textboxes_controller.rb +18 -0
  30. data/app/controllers/mega_bar/tmp_textreads_controller.rb +18 -0
  31. data/app/helpers/mega_bar/application_helper.rb +41 -0
  32. data/app/helpers/mega_bar/fields_helper.rb +13 -0
  33. data/app/helpers/mega_bar/models_helper.rb +13 -0
  34. data/app/models/mega_bar/checkbox.rb +8 -0
  35. data/app/models/mega_bar/field.rb +31 -0
  36. data/app/models/mega_bar/field_display.rb +25 -0
  37. data/app/models/mega_bar/mega_bar_model_concern.rb +20 -0
  38. data/app/models/mega_bar/model.rb +35 -0
  39. data/app/models/mega_bar/model_display.rb +10 -0
  40. data/app/models/mega_bar/radio_button.rb +6 -0
  41. data/app/models/mega_bar/records_format.rb +5 -0
  42. data/app/models/mega_bar/select.rb +9 -0
  43. data/app/models/mega_bar/test.rb +2 -0
  44. data/app/models/mega_bar/tester.rb +5 -0
  45. data/app/models/mega_bar/textarea.rb +9 -0
  46. data/app/models/mega_bar/textbox.rb +8 -0
  47. data/app/models/mega_bar/textread.rb +9 -0
  48. data/app/models/mega_bar/tmp_field.rb +6 -0
  49. data/app/models/mega_bar/tmp_field_display.rb +6 -0
  50. data/app/models/mega_bar/tmp_model.rb +6 -0
  51. data/app/models/mega_bar/tmp_model_display.rb +6 -0
  52. data/app/models/mega_bar/tmp_records_format.rb +6 -0
  53. data/app/models/mega_bar/tmp_select.rb +6 -0
  54. data/app/models/mega_bar/tmp_textbox.rb +6 -0
  55. data/app/models/mega_bar/tmp_textread.rb +6 -0
  56. data/app/views/mega_bar/application/_hello.html.erb +1 -0
  57. data/app/views/mega_bar/application/_mega_bar_read.html.erb +38 -0
  58. data/app/views/mega_bar/application/_mega_bar_write.html.erb +27 -0
  59. data/app/views/mega_bar/application/mega_bar.html.erb +62 -0
  60. data/app/views/textboxes/_form.html.erb +0 -0
  61. data/app/views/textboxes/edit.html.erb +0 -0
  62. data/app/views/textboxes/index.html.erb +0 -0
  63. data/app/views/textboxes/index.json.jbuilder +4 -0
  64. data/app/views/textboxes/new.html.erb +0 -0
  65. data/app/views/textboxes/show.html.erb +5 -0
  66. data/app/views/textboxes/show.json.jbuilder +1 -0
  67. data/app/views/textreads/_form.html.erb +0 -0
  68. data/app/views/textreads/edit.html.erb +0 -0
  69. data/app/views/textreads/index.html.erb +0 -0
  70. data/app/views/textreads/index.json.jbuilder +4 -0
  71. data/app/views/textreads/new.html.erb +0 -0
  72. data/app/views/textreads/show.html.erb +1 -0
  73. data/app/views/textreads/show.html.erb.orig.rhtml +0 -0
  74. data/app/views/textreads/show.json.jbuilder +1 -0
  75. data/config/routes.rb +30 -0
  76. data/db/mega_bar.seeds.rb +814 -0
  77. data/db/migrate/20140505150251_create_models.rb +12 -0
  78. data/db/migrate/20140505174947_create_model_displays.rb +11 -0
  79. data/db/migrate/20140505195607_create_records_formats.rb +11 -0
  80. data/db/migrate/20140505211530_create_textreads.rb +12 -0
  81. data/db/migrate/20140505214403_create_textboxes.rb +10 -0
  82. data/db/migrate/20140521220256_create_fields.rb +12 -0
  83. data/db/migrate/20140521222528_create_field_displays.rb +12 -0
  84. data/db/migrate/20140523160810_create_selects.rb +16 -0
  85. data/db/migrate/20140523200921_create_testers.rb +11 -0
  86. data/db/migrate/20140618170624_create_tests.rb +9 -0
  87. data/db/migrate/20141227235653_create_tmp_models.rb +11 -0
  88. data/db/migrate/20141228061208_create_mega_bar_tmp_fields.rb +12 -0
  89. data/db/migrate/20141228163900_create_mega_bar_tmp_model_displays.rb +11 -0
  90. data/db/migrate/20141228163956_create_mega_bar_tmp_field_displays.rb +11 -0
  91. data/db/migrate/20141228164052_create_mega_bar_tmp_records_formats.rb +10 -0
  92. data/db/migrate/20141228164245_create_mega_bar_tmp_textboxes.rb +10 -0
  93. data/db/migrate/20141228164314_create_mega_bar_tmp_textreads.rb +12 -0
  94. data/db/migrate/20141228164350_create_mega_bar_tmp_selects.rb +16 -0
  95. data/db/migrate/20141229173832_create_mega_bar_checkboxes.mega_bar.rb +8 -0
  96. data/db/migrate/20141229180849_create_mega_bar_radio_buttons.mega_bar.rb +8 -0
  97. data/db/migrate/20141230171751_create_mega_bar_textareas.mega_bar.rb +8 -0
  98. data/db/migrate/20141230173142_create_mega_bar_checkboxes.mega_bar.rb +9 -0
  99. data/lib/generators/mega_bar/mega_bar/USAGE +8 -0
  100. data/lib/generators/mega_bar/mega_bar/mega_bar_generator.rb +91 -0
  101. data/lib/generators/mega_bar/mega_bar/templates/generic_controller.rb +18 -0
  102. data/lib/generators/mega_bar/mega_bar/templates/generic_model.rb +6 -0
  103. data/lib/generators/mega_bar/mega_bar_fields/USAGE +8 -0
  104. data/lib/generators/mega_bar/mega_bar_fields/mega_bar_fields_generator.rb +13 -0
  105. data/lib/generators/mega_bar/mega_bar_fields/templates/generic_controller.rb +15 -0
  106. data/lib/generators/mega_bar/mega_bar_fields/templates/generic_model.rb +6 -0
  107. data/lib/mega_bar/engine.rb +15 -0
  108. data/lib/mega_bar/generators/mega_bar_generator.rb +6 -0
  109. data/lib/mega_bar/version.rb +3 -0
  110. data/lib/mega_bar.rb +4 -0
  111. data/lib/tasks/mega_bar_tasks.rake +270 -0
  112. metadata +393 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 963fe33ebd24dd16820dbc1106937c2f6cbabb1f
4
+ data.tar.gz: cf3c689eab72c5b754e8432097f2841a9167f9c7
5
+ SHA512:
6
+ metadata.gz: 82a13573ee782c9cdefb04d67637ecc7247df2eb4e8b5cb70021097159af6851e4a278da371ee2a49072261f25017d7058f888483a04e5c6fbdd7b946276febd
7
+ data.tar.gz: c21a61b1dc08f1523b90f893afbc31677a7f34ae3b3e08dea44c93041a5c665839a8b8c99a7bb73c1cf2ef331dee45b685754becaa666f4a7c20231264691cb0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,31 @@
1
+ = MegaBar
2
+
3
+ install the db tables:
4
+ bundle exec rake railties:install:migrations FROM=mega_bar
5
+ This project rocks and uses MIT-LICENSE.
6
+
7
+
8
+
9
+ Override use of automatic templating:
10
+
11
+ If none of the prebuilt 'record formats' suit your needs, but you'd still like to have access to the mega_bar things like the model and field information, you may want to write your own template. In your controller, add a method like this:
12
+
13
+ def index_view_template
14
+ @index_view_template ||= 'articles/my_index.html.erb'
15
+ end
16
+
17
+ Helper files:
18
+
19
+ If you'd like to provide values for virtual attributes on edit screens, or do anything like setting variables needed by the view, that needs to be done after the controller runs and before the view runs, create a helper file like this one that is in app/helpers/mega_bar/models_helper.rb:
20
+ module MegaBar
21
+ module ModelsHelper
22
+ def pre_render
23
+ if params[:action] == 'edit'
24
+ @index_model_display = ModelDisplay.by_model(@model.id).by_action('index').present? ? 'y':''
25
+ @show_model_display = ModelDisplay.by_model(@model.id).by_action('show').present? ? 'y':''
26
+ @new_model_display = ModelDisplay.by_model(@model.id).by_action('new').present? ? 'y':''
27
+ @edit_model_display = ModelDisplay.by_model(@model.id).by_action('edit').present? ? 'y':''
28
+ end
29
+ end
30
+ end
31
+ end
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'MegaBar'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../spec/test_app/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,28 @@
1
+ module MegaBar
2
+ class ApplicationController < ActionController::Base
3
+ # Prevent CSRF attacks by raising an exception.
4
+ # For APIs, you may want to use :null_session instead.
5
+ helper_method :sort_column, :sort_direction, :is_displayable
6
+ before_action :app_init
7
+
8
+ protect_from_forgery with: :exception
9
+ before_filter :index_view_template, only: :index
10
+ before_filter :show_view_template, only: :show
11
+ before_filter :edit_view_template, only: :edit
12
+ before_filter :new_view_template, only: :new
13
+
14
+
15
+ def index_view_template
16
+ @index_view_template ||= "mega_bar.html.erb"
17
+ end
18
+ def show_view_template
19
+ @show_view_template ||= "mega_bar.html.erb"
20
+ end
21
+ def edit_view_template
22
+ @edit_view_template ||= "mega_bar.html.erb"
23
+ end
24
+ def new_view_template
25
+ @new_view_template ||= "mega_bar.html.erb"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,19 @@
1
+
2
+ module MegaBar
3
+ class CheckboxesController < ApplicationController
4
+ include MegaBarConcern
5
+ before_action ->{ myinit 9 }, only: [:index, :show, :edit, :new]
6
+
7
+
8
+ private
9
+ def _params
10
+ permits = []
11
+ controller_name.classify.constantize.attribute_names.each do |att|
12
+ permits << att unless ['id', 'created_at', 'updated_at'].include?(att)
13
+ end
14
+ params.require(controller_name.singularize).permit(permits)
15
+ end
16
+
17
+
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ module MegaBar
2
+ class FieldDisplaysController < ApplicationController
3
+ include MegaBarConcern
4
+ before_action ->{ myinit 4 }, only: [:index, :show, :edit, :new]
5
+ private
6
+ # Never trust parameters from the scary internet, only allow the white list through.
7
+ def _params
8
+ params.require(:field_display).permit(:field_id, :format, :action, :header)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module MegaBar
2
+ class FieldsController < ApplicationController
3
+ include MegaBarConcern
4
+ before_action ->{ myinit 2 }, only: [:index, :show, :edit, :new]
5
+ private
6
+ # Never trust parameters from the scary internet, only allow the white list through.
7
+ def _params
8
+ params.require(:field).permit(:model_id, :schema, :tablename, :field, :default_value, :new_field_display, :edit_field_display, :index_field_display, :show_field_display)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,27 @@
1
+ module MegaBar
2
+ class GridHtml
3
+ attr_accessor :app_format
4
+ attr_accessor :app_wrapper
5
+ attr_accessor :field_header_wrapper
6
+ attr_accessor :app_wrapper_end
7
+ attr_accessor :field_header_wrapper
8
+ attr_accessor :field_header_wrapper_end
9
+ attr_accessor :record_wrapper
10
+ attr_accessor :record_wrapper_end
11
+ attr_accessor :field_wrapper
12
+ attr_accessor :field_wrapper_end
13
+ attr_accessor :separate_header_row
14
+ def initialize
15
+ @app_format = 'grid'
16
+ @app_wrapper = '<table>'
17
+ @app_wrapper_end = '</table>'
18
+ @field_header_wrapper = '<th>'
19
+ @field_header_wrapper_end = '</th>'
20
+ @record_wrapper = '<tr>'
21
+ @record_wrapper_end = '<th>'
22
+ @field_wrapper = '<td>'
23
+ @field_wrapper_end = '</td>'
24
+ @separate_header_row = true
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,169 @@
1
+ module MegaBar
2
+ module MegaBarConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ def app_init
6
+ #the crazyness starts right here.
7
+ tmp = params[:controller].include?('mega_bar') ? 'MegaBar::' + params[:controller][9..-1].classify : params[:controller].classify
8
+ @the_class = tmp.constantize
9
+ end
10
+
11
+ def myinit(model_id)
12
+ # yep, this is the main brain that loads all the model, model display, field, field_display stuff.
13
+ # after this runs you'll see the 'create' and 'update' type methods above run.
14
+ fields = Field.by_model(model_id)
15
+ unless fields
16
+ return redirect_to(:root, :notice => "There was no ModelDisplay for that action/format combo. Would you like to create one?")
17
+ end
18
+ field_ids = []
19
+ fields.each do |f|
20
+ field_ids << f.id
21
+ end
22
+ field_displays = FieldDisplay.by_fields(field_ids).by_action(params[:action])
23
+ displayable_fields = []
24
+ field_displays.each do |field_disp|
25
+ field = Field.find(field_disp.field_id)
26
+ if is_displayable?(field_disp.format)
27
+ #lets figure out how to display it right here.
28
+ display_format = Object.const_get('MegaBar::' + field_disp.format.classify).by_field_display_id(field_disp.id).last #data_display models have to have this scope!
29
+ displayable_fields << {:field_display=>field_disp, :field=>field, :display_format=>display_format, :obj=>@model}
30
+ end
31
+ end
32
+ model_display = ModelDisplay.by_model(model_id).by_action(params[:action]).last
33
+ unless model_display
34
+ return redirect_to(new_model_display_path, :notice => "There was no ModelDisplay for that " + params[:action] +" action and " + model_id.to_s + "model_id combo. Would you like to create one?")
35
+ end
36
+ record_format = MegaBar::RecordsFormat.find(model_display.format)
37
+ @mega_bar = {
38
+ :app_format => Object.const_get('MegaBar::' + record_format.name).new,
39
+ :field_ids => field_ids,
40
+ :fields => fields,
41
+ :field_displays => field_displays,
42
+ :displayable_fields => displayable_fields,
43
+ :form_path => form_path,
44
+ :model_id => model_id,
45
+ :model_display => model_display,
46
+ :model_properties => Model.find(model_id),
47
+ :record_format => record_format
48
+ }
49
+ @controller = params[:controller].include?('mega_bar') ? params[:controller][9..-1] : params[:controller]
50
+ end
51
+
52
+ # GET /models
53
+ # GET /models.json
54
+ def index
55
+ #seems like you have to have an instance variable for the specific model because if you don't it doesn't pay attention to using your 'layout'
56
+ #so we set one but then for convenience in the layout, we set @models equal to that.
57
+
58
+ instance_variable_set("@" + @controller, @the_class.order(sort_column + " " + sort_direction))
59
+ @models = instance_variable_get("@" + @controller);
60
+ render @index_view_template
61
+ end
62
+
63
+ def show
64
+ instance_variable_set("@" + @controller.singularize, @the_class.find(params[:id]))
65
+ @models = []
66
+ @models << instance_variable_get("@" + @controller.singularize);
67
+ render @show_view_template
68
+ end
69
+
70
+ def new
71
+ instance_variable_set("@" + @controller.singularize, @the_class.new)
72
+ @model = instance_variable_get("@" + @controller.singularize);
73
+ render @new_view_template
74
+ end
75
+
76
+ def edit
77
+ instance_variable_set("@" + @controller.singularize, @the_class.find(params[:id]))
78
+ @model = instance_variable_get("@" + @controller.singularize)
79
+ render @edit_view_template
80
+ end
81
+
82
+ def create
83
+
84
+ @model = @the_class.new(_params)
85
+ respond_to do |format|
86
+ if @model.save
87
+ format.html { redirect_to @model, notice: 'It was successfully created.' }
88
+ format.json { render action: 'show', status: :created, location: @model }
89
+ else
90
+ format.html { render action: 'new' }
91
+ format.json { render json: @model.errors, status: :unprocessable_entity }
92
+ end
93
+ end
94
+ end
95
+ # PATCH/PUT /models/1
96
+ # PATCH/PUT /models/1.json
97
+ def update
98
+ set_the_display
99
+ respond_to do |format|
100
+ if @model.update(_params)
101
+ logger.info "UUUUUUUUUU"
102
+ format.html { redirect_to @model, notice: 'Thing was successfully updated.' }
103
+ format.json { head :no_content }
104
+ else
105
+ logger.info "FffFFFFFFFF"
106
+ format.html { render action: 'edit' }
107
+ format.json { render json: @model.errors, status: :unprocessable_entity }
108
+ end
109
+ end
110
+ end
111
+ def destroy
112
+ instance_variable_set("@" + params[:controller][9..-1].classify.singularize, @the_class.find(params[:id]))
113
+ @model = instance_variable_get("@" + params[:controller][9..-1].classify.singularize);
114
+ @model.destroy
115
+ respond_to do |format|
116
+ format.html { redirect_to models_url }
117
+ format.json { head :no_content }
118
+ end
119
+ end
120
+
121
+ def set_the_display
122
+ instance_variable_set("@" + params[:controller][9..-1].classify, @the_class.find(params[:id]))
123
+ @model = instance_variable_get("@" + params[:controller][9..-1].classify);
124
+ end
125
+
126
+ def testing
127
+ logger.info 'tested it'
128
+ #abort('tested it i did')
129
+ end
130
+
131
+
132
+ def form_path
133
+ case params[:action]
134
+ when 'index'
135
+ url_for(controller: params[:controller].to_s,
136
+ action: params[:action],
137
+ only_path: true)
138
+ when 'new'
139
+ url_for(controller: params[:controller].to_s,
140
+ action: 'create',
141
+ only_path: true)
142
+ when 'edit'
143
+ url_for(controller: params[:controller].to_s,
144
+ action: 'update',
145
+ only_path: true)
146
+ else
147
+ form_path = 'ack'
148
+ end
149
+ end
150
+
151
+ def sort_column
152
+ @the_class.column_names.include?(params[:sort]) ? params[:sort] : @mega_bar[:model_properties][:default_sort_field]
153
+ end
154
+ def sort_direction
155
+ %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
156
+ end
157
+
158
+ def is_displayable?(format)
159
+ if format == 'hidden' || format == 'off'
160
+ false
161
+ else
162
+ logger.info "is_displayable" + format
163
+ true
164
+ end
165
+ end
166
+
167
+
168
+ end
169
+ end
@@ -0,0 +1,11 @@
1
+ module MegaBar
2
+ class ModelDisplaysController < ApplicationController
3
+ include MegaBarConcern
4
+ before_action ->{ myinit 3 }, only: [:index, :show, :edit, :new]
5
+ private
6
+ # Never trust parameters from the scary internet, only allow the white list through.
7
+ def _params
8
+ params.require(:model_display).permit(:model_id, :format, :action, :header)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ module MegaBar
2
+ class ModelsController < ApplicationController
3
+ include MegaBarConcern
4
+ # attr_accessor :edit_model_display
5
+ before_action ->{ myinit 1 }, only: [:index, :show, :edit, :new]
6
+ #before_action :app_init, only: [:index, :show, :edit, :new]
7
+ private
8
+ # Never trust parameters from the scary internet, only allow the white list through.
9
+ def _params
10
+ # params.require(:model).permit(:model:classname, :schema, :tablename, :name)
11
+ params.require(:model).permit(:classname, :schema, :tablename, :name, :default_sort_field, :index_model_display, :show_model_display, :new_model_display, :edit_model_display)
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,27 @@
1
+ module MegaBar
2
+ class ProfileTable
3
+ attr_accessor :app_format
4
+ attr_accessor :app_wrapper
5
+ attr_accessor :field_header_wrapper
6
+ attr_accessor :app_wrapper_end
7
+ attr_accessor :field_header_wrapper
8
+ attr_accessor :field_header_wrapper_end
9
+ attr_accessor :record_wrapper
10
+ attr_accessor :record_wrapper_end
11
+ attr_accessor :field_wrapper
12
+ attr_accessor :field_wrapper_end
13
+ attr_accessor :separate_header_row
14
+ def initialize
15
+ @app_format = 'profile_table'
16
+ @app_wrapper = '<table>'
17
+ @app_wrapper_end = '</table>'
18
+ @field_header_wrapper = '<th>'
19
+ @field_header_wrapper_end = '</th>'
20
+ @record_wrapper = '<tr>'
21
+ @record_wrapper_end = '<th>'
22
+ @field_wrapper = '<td>'
23
+ @field_wrapper_end = '</td>'
24
+ @separate_header_row = false
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module MegaBar
3
+ class RadioButtonsController < ApplicationController
4
+ include MegaBarConcern
5
+ before_action ->{ myinit 9 }, only: [:index, :show, :edit, :new]
6
+
7
+
8
+ private
9
+ def _params
10
+ permits = []
11
+ controller_name.classify.constantize.attribute_names.each do |att|
12
+ permits << att unless ['id', 'created_at', 'updated_at'].include?(att)
13
+ end
14
+ params.require(controller_name.singularize).permit(permits)
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,10 @@
1
+ module MegaBar
2
+ class RecordsFormatsController < ApplicationController
3
+ include MegaBarConcern
4
+ before_action ->{ myinit 5 }, only: [:index, :show, :edit, :new]
5
+ private
6
+ def _params
7
+ params.require(:records_format).permit(:name, :classname, :type)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,12 @@
1
+ module MegaBar
2
+ class SelectsController < ApplicationController
3
+ include MegaBarConcern
4
+ before_action ->{ myinit 8 }, only: [:index, :show, :edit, :new]
5
+
6
+ private
7
+ def _params
8
+ params.require(:textread).permit(:field_display_id, :model, :field, :collection, :value_method, :text_method, :data_size, :include_blank)
9
+ end
10
+
11
+ end
12
+ end
@@ -0,0 +1,11 @@
1
+ module MegaBar
2
+ class TestersController < ApplicationController
3
+ include MegaBarConcern
4
+ before_action ->{ myinit 12 }, only: [:index, :show, :edit, :new]
5
+
6
+ private
7
+ def _params
8
+ params.require(:tester).permit(:one, :two, :three, :four)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module MegaBar
2
+
3
+ class TestsController < InheritedResources::Base
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module MegaBar
2
+ class TextboxesController < ApplicationController
3
+ include MegaBarConcern
4
+ before_action ->{ myinit 6 }, only: [:index, :show, :edit, :new]
5
+ private
6
+ # Never trust parameters from the scary internet, only allow the white list through.
7
+ def _params
8
+ params.require(:textbox).permit(:field_display_id, :size)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ module MegaBar
2
+ class TextreadsController < ApplicationController
3
+ include MegaBarConcern
4
+ before_action ->{ myinit 7 }, only: [:index, :show, :edit, :new]
5
+ private
6
+ def _params
7
+ params.require(:textread).permit(:field_display_id, :truncation, :truncation_format, :transformation)
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module MegaBar
3
+ class TmpFieldDisplaysController < ApplicationController
4
+ include MegaBarConcern
5
+ before_action ->{ myinit 13 }, only: [:index, :show, :edit, :new]
6
+
7
+
8
+ private
9
+ def _params
10
+ permits = []
11
+ controller_name.classify.constantize.attribute_names.each do |att|
12
+ permits << att unless ['id', 'created_at', 'updated_at'].include?(att)
13
+ end
14
+ params.require(controller_name.singularize).permit(permits)
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module MegaBar
3
+ class TmpFieldsController < ApplicationController
4
+ include MegaBarConcern
5
+ before_action ->{ myinit 11 }, only: [:index, :show, :edit, :new]
6
+
7
+
8
+ private
9
+ def _params
10
+ permits = []
11
+ controller_name.classify.constantize.attribute_names.each do |att|
12
+ permits << att unless ['id', 'created_at', 'updated_at'].include?(att)
13
+ end
14
+ params.require(controller_name.singularize).permit(permits)
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module MegaBar
3
+ class TmpModelDisplaysController < ApplicationController
4
+ include MegaBarConcern
5
+ before_action ->{ myinit 12 }, only: [:index, :show, :edit, :new]
6
+
7
+
8
+ private
9
+ def _params
10
+ permits = []
11
+ controller_name.classify.constantize.attribute_names.each do |att|
12
+ permits << att unless ['id', 'created_at', 'updated_at'].include?(att)
13
+ end
14
+ params.require(controller_name.singularize).permit(permits)
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module MegaBar
2
+ class TmpModelsController < ApplicationController
3
+ include MegaBarConcern
4
+ before_action ->{ myinit 10 }, only: [:index, :show, :edit, :new]
5
+
6
+ private
7
+
8
+ def _params
9
+ permits = []
10
+ controller_name.classify.constantize.attribute_names.each do |att|
11
+ permits << att unless ['id', 'created_at', 'updated_at'].include?(att)
12
+ end
13
+ params.require(controller_name.singularize).permit(permits)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module MegaBar
3
+ class TmpRecordsFormatsController < ApplicationController
4
+ include MegaBarConcern
5
+ before_action ->{ myinit 14 }, only: [:index, :show, :edit, :new]
6
+
7
+
8
+ private
9
+ def _params
10
+ permits = []
11
+ controller_name.classify.constantize.attribute_names.each do |att|
12
+ permits << att unless ['id', 'created_at', 'updated_at'].include?(att)
13
+ end
14
+ params.require(controller_name.singularize).permit(permits)
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module MegaBar
3
+ class TmpSelectsController < ApplicationController
4
+ include MegaBarConcern
5
+ before_action ->{ myinit 17 }, only: [:index, :show, :edit, :new]
6
+
7
+
8
+ private
9
+ def _params
10
+ permits = []
11
+ controller_name.classify.constantize.attribute_names.each do |att|
12
+ permits << att unless ['id', 'created_at', 'updated_at'].include?(att)
13
+ end
14
+ params.require(controller_name.singularize).permit(permits)
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module MegaBar
3
+ class TmpTextboxesController < ApplicationController
4
+ include MegaBarConcern
5
+ before_action ->{ myinit 15 }, only: [:index, :show, :edit, :new]
6
+
7
+
8
+ private
9
+ def _params
10
+ permits = []
11
+ controller_name.classify.constantize.attribute_names.each do |att|
12
+ permits << att unless ['id', 'created_at', 'updated_at'].include?(att)
13
+ end
14
+ params.require(controller_name.singularize).permit(permits)
15
+ end
16
+
17
+ end
18
+ end