humdrum-rails 0.1.1 → 0.1.2
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 +4 -4
- data/README.md +212 -1
- data/humdrum-rails.gemspec +1 -1
- data/lib/humdrum/version.rb +1 -1
- data/lib/rails/generators/humdrum/api/templates/models/resource.rb +8 -8
- data/lib/rails/generators/humdrum/layout/layout_generator.rb +37 -37
- data/lib/rails/generators/humdrum/layout/templates/controllers/application_controller.rb +7 -3
- data/lib/rails/generators/humdrum/layout/templates/helpers/display_helper.rb +4 -12
- data/lib/rails/generators/humdrum/layout/templates/helpers/params_parser_helper.rb +1 -16
- data/lib/rails/generators/humdrum/layout/templates/stylesheets/application.css +6 -5
- data/lib/rails/generators/humdrum/layout/templates/stylesheets/bootstrap3/overrides-bootstrap.css +9 -6
- data/lib/rails/generators/humdrum/layout/templates/views/bootstrap2/layouts/application.html.erb +14 -14
- data/lib/rails/generators/humdrum/layout/templates/views/bootstrap2/layouts/common/_flash_message.html.erb +4 -4
- data/lib/rails/generators/humdrum/layout/templates/views/bootstrap2/layouts/layout_name.html.erb +15 -15
- data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/application/_header.html.erb +18 -33
- data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/application.html.erb +15 -15
- data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/common/_flash_message.html.erb +4 -4
- data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/layout_name.html.erb +15 -15
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/application.html.erb +13 -13
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/common/_flash_message.html.erb +4 -4
- data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/layout_name.html.erb +13 -13
- data/lib/rails/generators/humdrum/resource/templates/controllers/resource_controller.rb +53 -49
- data/lib/rails/generators/humdrum/resource/templates/models/resource.rb +9 -11
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_edit.html.erb +2 -2
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_field.html.erb +7 -7
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_filters.html.erb +2 -2
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_form.html.erb +33 -33
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_index.html.erb +1 -1
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_item.html.erb +9 -9
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_nav_filters.html.erb +3 -3
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_new.html.erb +2 -2
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_show.html.erb +13 -13
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_summary.html.erb +1 -1
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/index.html.erb +6 -6
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/index.js.erb +3 -3
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_drop_down.html.erb +1 -1
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_edit.html.erb +2 -2
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_field.html.erb +12 -12
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_filters.html.erb +5 -5
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_form.html.erb +21 -21
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_index.html.erb +1 -1
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_item.html.erb +15 -15
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_nav_filters.html.erb +3 -3
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_new.html.erb +2 -2
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_show.html.erb +20 -20
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_summary.html.erb +1 -1
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/destroy.js.erb +4 -4
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/index.html.erb +7 -7
- data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/index.js.erb +3 -3
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_edit.html.erb +2 -2
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_field.html.erb +7 -7
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_filters.html.erb +1 -1
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_form.html copy.erb +13 -13
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_form.html.erb +18 -18
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_index.html.erb +1 -1
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_item.html.erb +9 -9
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_nav_filters.html.erb +3 -3
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_new.html.erb +2 -2
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_show.html.erb +19 -19
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_summary.html.erb +1 -1
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/index.html.erb +6 -6
- data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/index.js.erb +3 -3
- data/lib/rails/generators/humdrum/setup/setup_generator.rb +21 -26
- data/lib/rails/generators/humdrum/setup/templates/config/database.example.sql +17 -40
- data/lib/rails/generators/humdrum/setup/templates/config/database.sql +16 -38
- metadata +6 -6
@@ -1,16 +1,16 @@
|
|
1
1
|
class <%= controller_class %> < ApplicationController
|
2
|
-
|
2
|
+
|
3
3
|
#before_filter :require_user
|
4
4
|
#authorize_actions_for Item, :actions => {:index => :delete}
|
5
5
|
before_filter :set_navs, :parse_pagination_params, :only=>:index
|
6
|
-
|
6
|
+
|
7
7
|
# GET /<%= instances_name %>
|
8
8
|
# GET /<%= instances_name %>.js
|
9
9
|
# GET /<%= instances_name %>.json
|
10
10
|
def index
|
11
|
-
|
11
|
+
|
12
12
|
get_collections
|
13
|
-
|
13
|
+
|
14
14
|
respond_to do |format|
|
15
15
|
format.html # index.html.erb
|
16
16
|
format.json { render json: @<%= instances_name %> }
|
@@ -22,9 +22,9 @@ class <%= controller_class %> < ApplicationController
|
|
22
22
|
# GET /<%= instances_name %>/1.js
|
23
23
|
# GET /<%= instances_name %>/1.json
|
24
24
|
def show
|
25
|
-
## Creating the <%= instance_name %> object
|
25
|
+
## Creating the <%= instance_name %> object
|
26
26
|
@<%= instance_name %> = <%= model_class %>.find(params[:id])
|
27
|
-
|
27
|
+
|
28
28
|
respond_to do |format|
|
29
29
|
format.html { get_collections and render :index }
|
30
30
|
format.json { render json: @<%= instance_name %> }
|
@@ -35,9 +35,9 @@ class <%= controller_class %> < ApplicationController
|
|
35
35
|
# GET /<%= instances_name %>/new
|
36
36
|
# GET /<%= instances_name %>/new.json
|
37
37
|
def new
|
38
|
-
## Intitializing the <%= instance_name %> object
|
38
|
+
## Intitializing the <%= instance_name %> object
|
39
39
|
@<%= instance_name %> = <%= model_class %>.new
|
40
|
-
|
40
|
+
|
41
41
|
respond_to do |format|
|
42
42
|
format.html { get_collections and render :index }
|
43
43
|
format.json { render json: @<%= instance_name %> }
|
@@ -47,9 +47,9 @@ class <%= controller_class %> < ApplicationController
|
|
47
47
|
|
48
48
|
# GET /<%= instances_name %>/1/edit
|
49
49
|
def edit
|
50
|
-
## Fetching the <%= instance_name %> object
|
50
|
+
## Fetching the <%= instance_name %> object
|
51
51
|
@<%= instance_name %> = <%= model_class %>.find(params[:id])
|
52
|
-
|
52
|
+
|
53
53
|
respond_to do |format|
|
54
54
|
format.html { get_collections and render :index }
|
55
55
|
format.json { render json: @<%= instance_name %> }
|
@@ -61,33 +61,33 @@ class <%= controller_class %> < ApplicationController
|
|
61
61
|
# POST /<%= instances_name %>.js
|
62
62
|
# POST /<%= instances_name %>.json
|
63
63
|
def create
|
64
|
-
## Creating the <%= instance_name %> object
|
65
|
-
@<%= instance_name %> = <%= model_class %>.new(
|
66
|
-
|
64
|
+
## Creating the <%= instance_name %> object
|
65
|
+
@<%= instance_name %> = <%= model_class %>.new(<%= instance_name %>_params)
|
66
|
+
|
67
67
|
## Validating the data
|
68
68
|
@<%= instance_name %>.valid?
|
69
|
-
|
69
|
+
|
70
70
|
respond_to do |format|
|
71
71
|
if @<%= instance_name %>.errors.blank?
|
72
|
-
|
72
|
+
|
73
73
|
# Saving the <%= instance_name %> object
|
74
74
|
@<%= instance_name %>.save
|
75
|
-
|
75
|
+
|
76
76
|
# Setting the flash message
|
77
77
|
message = translate("forms.created_successfully", :item => "<%= instance_name.titleize %>")
|
78
78
|
store_flash_message(message, :success)
|
79
|
-
|
80
|
-
format.html {
|
79
|
+
|
80
|
+
format.html {
|
81
81
|
redirect_to <%= resource_link('show','url') %>(@<%= instance_name %>), notice: message
|
82
82
|
}
|
83
83
|
format.json { render json: @<%= instance_name %>, status: :created, location: @<%= instance_name %> }
|
84
84
|
format.js {}
|
85
85
|
else
|
86
|
-
|
86
|
+
|
87
87
|
# Setting the flash message
|
88
88
|
message = @<%= instance_name %>.errors.full_messages.to_sentence
|
89
89
|
store_flash_message(message, :alert)
|
90
|
-
|
90
|
+
|
91
91
|
format.html { render action: "new" }
|
92
92
|
format.json { render json: @<%= instance_name %>.errors, status: :unprocessable_entity }
|
93
93
|
format.js {}
|
@@ -101,41 +101,41 @@ class <%= controller_class %> < ApplicationController
|
|
101
101
|
def update
|
102
102
|
## Fetching the <%= instance_name %>
|
103
103
|
@<%= instance_name %> = <%= model_class %>.find(params[:id])
|
104
|
-
|
104
|
+
|
105
105
|
## Updating the @<%= instance_name %> object with params
|
106
|
-
@<%= instance_name %>.assign_attributes(
|
107
|
-
|
106
|
+
@<%= instance_name %>.assign_attributes(<%= instance_name %>_params)
|
107
|
+
|
108
108
|
## Validating the data
|
109
109
|
@<%= instance_name %>.valid?
|
110
|
-
|
110
|
+
|
111
111
|
respond_to do |format|
|
112
112
|
if @<%= instance_name %>.errors.blank?
|
113
|
-
|
113
|
+
|
114
114
|
# Saving the <%= instance_name %> object
|
115
115
|
@<%= instance_name %>.save
|
116
|
-
|
116
|
+
|
117
117
|
# Setting the flash message
|
118
118
|
message = translate("forms.updated_successfully", :item => "<%= instance_name.titleize %>")
|
119
119
|
store_flash_message(message, :success)
|
120
|
-
|
121
|
-
format.html {
|
122
|
-
redirect_to <%= resource_link('show','url') %>(@<%= instance_name %>), notice: message
|
120
|
+
|
121
|
+
format.html {
|
122
|
+
redirect_to <%= resource_link('show','url') %>(@<%= instance_name %>), notice: message
|
123
123
|
}
|
124
124
|
format.json { head :no_content }
|
125
125
|
format.js {}
|
126
|
-
|
126
|
+
|
127
127
|
else
|
128
|
-
|
128
|
+
|
129
129
|
# Setting the flash message
|
130
130
|
message = @<%= instance_name %>.errors.full_messages.to_sentence
|
131
131
|
store_flash_message(message, :alert)
|
132
|
-
|
133
|
-
format.html {
|
134
|
-
render action: "edit"
|
132
|
+
|
133
|
+
format.html {
|
134
|
+
render action: "edit"
|
135
135
|
}
|
136
136
|
format.json { render json: @<%= instance_name %>.errors, status: :unprocessable_entity }
|
137
137
|
format.js {}
|
138
|
-
|
138
|
+
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
@@ -146,7 +146,7 @@ class <%= controller_class %> < ApplicationController
|
|
146
146
|
def destroy
|
147
147
|
## Fetching the <%= instance_name %>
|
148
148
|
@<%= instance_name %> = <%= model_class %>.find(params[:id])
|
149
|
-
|
149
|
+
|
150
150
|
respond_to do |format|
|
151
151
|
## Destroying the <%= instance_name %>
|
152
152
|
@<%= instance_name %>.destroy
|
@@ -155,43 +155,47 @@ class <%= controller_class %> < ApplicationController
|
|
155
155
|
# Fetch the <%= instances_name %> to refresh ths list and details box
|
156
156
|
get_collections
|
157
157
|
@<%= instance_name %> = @<%= instances_name %>.first if @<%= instances_name %> and @<%= instances_name %>.any?
|
158
|
-
|
158
|
+
|
159
159
|
# Setting the flash message
|
160
160
|
message = translate("forms.destroyed_successfully", :item => "<%= instance_name.titleize %>")
|
161
161
|
store_flash_message(message, :success)
|
162
|
-
|
163
|
-
format.html {
|
162
|
+
|
163
|
+
format.html {
|
164
164
|
redirect_to <%= resource_link('index', 'url') %> notice: message
|
165
165
|
}
|
166
166
|
format.json { head :no_content }
|
167
167
|
format.js {}
|
168
|
-
|
168
|
+
|
169
169
|
end
|
170
170
|
end
|
171
|
-
|
171
|
+
|
172
172
|
private
|
173
|
-
|
173
|
+
|
174
174
|
def set_navs
|
175
175
|
set_nav("<%= model_class %>")
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
def get_collections
|
179
179
|
# Fetching the <%= instances_name %>
|
180
180
|
relation = <%= model_class %>.where("")
|
181
181
|
@filters = {}
|
182
|
-
|
182
|
+
|
183
183
|
if params[:query]
|
184
184
|
@query = params[:query].strip
|
185
185
|
relation = relation.search(@query) if !@query.blank?
|
186
186
|
end
|
187
|
-
|
187
|
+
|
188
188
|
@<%= instances_name %> = relation.order("created_at desc").page(@current_page).per(@per_page)
|
189
|
-
|
189
|
+
|
190
190
|
## Initializing the @<%= instance_name %> object so that we can render the show partial
|
191
191
|
@<%= instance_name %> = @<%= instances_name %>.first unless @<%= instance_name %>
|
192
|
-
|
192
|
+
|
193
193
|
return true
|
194
|
-
|
194
|
+
|
195
195
|
end
|
196
|
-
|
196
|
+
|
197
|
+
def <%= instance_name %>_params
|
198
|
+
params.require(:<%= instance_name %>).permit(<%= fields.keys.map{|x| ":" + x.downcase }.join(", ") %>)
|
199
|
+
end
|
200
|
+
|
197
201
|
end
|
@@ -1,7 +1,5 @@
|
|
1
1
|
class <%= model_class %> < ActiveRecord::Base
|
2
|
-
|
3
|
-
attr_accessible <%= fields.keys.map{|x| ":" + x.downcase }.join(", ") %>
|
4
|
-
|
2
|
+
|
5
3
|
# Validations
|
6
4
|
<%- fields.each do |name, type| -%>
|
7
5
|
<%- if type == "string" %>
|
@@ -11,29 +9,29 @@ class <%= model_class %> < ActiveRecord::Base
|
|
11
9
|
<%- elsif type == "integer" %>
|
12
10
|
#validates :<%= name %>, presence: true, numericality: true, if: proc{|x| x.condition? }
|
13
11
|
<%- elsif type == "decimal" || type == "float" %>
|
14
|
-
#validates :<%= name %>, format: { with: /^\d+??(?:\.\d{0,2})?$/ },
|
12
|
+
#validates :<%= name %>, format: { with: /^\d+??(?:\.\d{0,2})?$/ },
|
15
13
|
:numericality =>{:greater_than => 0}
|
16
14
|
<%- elsif type != "boolean" %>
|
17
15
|
#validates :<%= name %>, presence: true
|
18
16
|
<%- end -%>
|
19
17
|
<%- end -%>
|
20
|
-
|
18
|
+
|
21
19
|
# Validation Examples
|
22
20
|
#LANDLINE_LIST = ["1234567890", "0987654321"]
|
23
|
-
#validates :first_name,
|
21
|
+
#validates :first_name,
|
24
22
|
# presence: true,
|
25
23
|
# length: {minimum: ConfigCenter::GeneralValidations::FIRST_NAME_MIN_LEN ,
|
26
|
-
# maximum: ConfigCenter::GeneralValidations::FIRST_NAME_MAX_LEN, message: "should be less than x and greater than y"},
|
24
|
+
# maximum: ConfigCenter::GeneralValidations::FIRST_NAME_MAX_LEN, message: "should be less than x and greater than y"},
|
27
25
|
# uniqueness: {scope: [:user_id, :status], case_sensitive: false},
|
28
26
|
# format: {with: ConfigCenter::GeneralValidations::FIRST_NAME_FORMAT_REG_EXP, message: "Invalid format"},
|
29
27
|
# inclusion: { in: PHONE_LIST, message: "not included in the list" },
|
30
28
|
# unless: proc{|user| user.password.blank? }
|
31
|
-
|
32
|
-
|
29
|
+
|
30
|
+
|
33
31
|
# Associations
|
34
32
|
#belongs_to :user, foreign_key: :owner_id
|
35
33
|
#has_many :products
|
36
|
-
|
34
|
+
|
37
35
|
# return an active record relation object with the search query in its where clause
|
38
36
|
# Return the ActiveRecord::Relation object
|
39
37
|
# == Examples
|
@@ -48,5 +46,5 @@ class <%= model_class %> < ActiveRecord::Base
|
|
48
46
|
<% end -%>
|
49
47
|
<% end -%>
|
50
48
|
}
|
51
|
-
|
49
|
+
|
52
50
|
end
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_edit.html.erb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<%%# Used to add a <%= model_class %> %>
|
2
|
-
<div class="box
|
3
|
-
<div class="
|
2
|
+
<div class="box p-10">
|
3
|
+
<div class="p-10 text-color-grey fs-18 mb-20">
|
4
4
|
Edit <%= instance_title %>
|
5
5
|
</div>
|
6
6
|
<%%= render 'form' %>
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_field.html.erb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<%%
|
1
|
+
<%%
|
2
2
|
unless defined?(required)
|
3
3
|
required = false
|
4
4
|
end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
<div class="row">
|
14
14
|
<%% if ["text", "email", "search", "password", "date", "time", "tel", "url", "month", "file", "image", ""].include?(input_type) %>
|
15
15
|
<div class="span5">
|
16
|
-
<span class="text-color-red pull-right
|
16
|
+
<span class="text-color-red pull-right ml-10 mr--5"><%%= required ? "*" : raw(" ") %></span>
|
17
17
|
<label class="pull-right <%%= label_class %>" for="<%%= inp_id %>" ><%%= display_name %></label>
|
18
18
|
</div>
|
19
19
|
<div class="span7">
|
@@ -23,18 +23,18 @@
|
|
23
23
|
</div>
|
24
24
|
<%% elsif input_type == "checkbox" %>
|
25
25
|
<div class="span5">
|
26
|
-
<span class="text-color-red pull-right
|
26
|
+
<span class="text-color-red pull-right ml-10 mr--5"><%%= required ? "*" : raw(" ") %></span>
|
27
27
|
<label class="pull-right <%%= label_class %>" for="<%%= inp_id %>" ><%%= display_name %></label>
|
28
28
|
</div>
|
29
|
-
<div class="span7
|
30
|
-
<input name="<%%= object_name %>[<%%= field_name %>]" id="inp_<%%= display_name.underscore.split(" ").join("_") %>" type="<%%= input_type %>" class="checkbox input pull-left
|
29
|
+
<div class="span7 mb-10">
|
30
|
+
<input name="<%%= object_name %>[<%%= field_name %>]" id="inp_<%%= display_name.underscore.split(" ").join("_") %>" type="<%%= input_type %>" class="checkbox input pull-left m-5" <%%= object.send(field_name.to_s) ? "checked='checked'" : "" %> />
|
31
31
|
</div>
|
32
32
|
<%% elsif input_type == "textarea" %>
|
33
33
|
<div class="span5">
|
34
|
-
<span class="text-color-red pull-right
|
34
|
+
<span class="text-color-red pull-right ml-10 mr--5"><%%= required ? "*" : raw(" ") %></span>
|
35
35
|
<label class="pull-right <%%= label_class %>" for="<%%= inp_id %>" ><%%= display_name %></label>
|
36
36
|
</div>
|
37
|
-
<div class="span7
|
37
|
+
<div class="span7 mb-10">
|
38
38
|
<textarea name="<%%= object_name %>[<%%= field_name %>]" id="inp_<%%= display_name.underscore.split(" ").join("_") %> placeholder="<%%= place_holder %>" "><%%= object.send(field_name.to_s) %></textarea>
|
39
39
|
</div>
|
40
40
|
<%% end %>
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_filters.html.erb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
<%%= link_to raw("<i class='icon-plus icon-white
|
1
|
+
<%%= link_to raw("<i class='icon-plus icon-white mr--5'></i> New Item"), <%= resource_link('new', 'path') %>, :class=>"btn btn-warning pull-right ml-10", :remote=>true %>
|
2
2
|
|
3
3
|
<%# Used to add a search functionality %>
|
4
|
-
<%%= form_for <%= model_class %>.new, :url => <%= resource_link('index', 'path') %>, :method => :get, :remote=>true, :html=>{:class=>"pull-right", :style=>"
|
4
|
+
<%%= form_for <%= model_class %>.new, :url => <%= resource_link('index', 'path') %>, :method => :get, :remote=>true, :html=>{:class=>"pull-right", :style=>"m-bottom:0px;"} do |f| %>
|
5
5
|
<div class="input-append">
|
6
6
|
<input type="text" style="width:160px;" name="item[query]" placeholder="Search Item ...">
|
7
7
|
<button type="submit" class="btn btn-inverse"><i class="icon-search icon-white"></i></button>
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_form.html.erb
CHANGED
@@ -1,81 +1,81 @@
|
|
1
1
|
|
2
2
|
<%%# Renders a partial which is used to create a new <%= instance_name %> %>
|
3
3
|
<<<<<<< Local Changes
|
4
|
-
<%%= form_for(@<%= instance_name %>, :html => {:id=>"form_<%= instance_name %>", :class=>"
|
4
|
+
<%%= form_for(@<%= instance_name %>, :html => {:id=>"form_<%= instance_name %>", :class=>"mb-0", :method => (@<%= instance_name %>.new_record? ? :post : :put), :remote=>true}) do |f| %>
|
5
5
|
|
6
6
|
<%%= @<%= instance_name %>.errors[:base].to_sentence %>
|
7
|
-
|
7
|
+
|
8
8
|
<%%= hidden_field_tag :faction, @<%= instance_name %>.new_record? ? <%= instances_name %>_path : <%= instance_name %>_path(@<%= instance_name %>) %>
|
9
9
|
<%%= hidden_field_tag :fmethod, @<%= instance_name %>.new_record? ? "POST" : "PUT" %>
|
10
10
|
|
11
11
|
<div class="form-inputs">
|
12
|
-
|
12
|
+
|
13
13
|
<%- fields.each do |name, type| %>
|
14
14
|
<!-- <%= name.titleize -%> (<%= type -%>) -->
|
15
|
-
<%%= render :partial=>"field", :locals=>{:object=>@<%= instance_name %>,
|
16
|
-
:object_name=>'<%= instance_name %>',
|
17
|
-
:field_name=>'<%= name %>',
|
18
|
-
:display_name=>'<%= name.titleize %>',
|
19
|
-
:field_type=>'<%= type %>',
|
20
|
-
:input_type=>'<%= guess_input_type(name, type) %>',
|
21
|
-
:required=>true,
|
15
|
+
<%%= render :partial=>"field", :locals=>{:object=>@<%= instance_name %>,
|
16
|
+
:object_name=>'<%= instance_name %>',
|
17
|
+
:field_name=>'<%= name %>',
|
18
|
+
:display_name=>'<%= name.titleize %>',
|
19
|
+
:field_type=>'<%= type %>',
|
20
|
+
:input_type=>'<%= guess_input_type(name, type) %>',
|
21
|
+
:required=>true,
|
22
22
|
:place_holder=>"e.g: Put a suitable example here."} %>
|
23
23
|
<%- end -%>
|
24
|
-
|
24
|
+
|
25
25
|
</div>
|
26
|
-
|
26
|
+
|
27
27
|
<%% button_text = "#{@<%= instance_name %>.new_record? ? "Create" : "Update"} Item" %>
|
28
28
|
<div class="pull-right">
|
29
29
|
<%% if @<%= instance_name %>.new_record? %>
|
30
30
|
<%%= link_to "Cancel", "#", :class => "btn", :remote=>true %>
|
31
31
|
<%% else %>
|
32
|
-
<%%= link_to 'Back', <%= resource_link('index', 'path') %>, :class=>"btn
|
32
|
+
<%%= link_to 'Back', <%= resource_link('index', 'path') %>, :class=>"btn ml-10", :remote => true unless @<%= instance_name %>.new_record? %>
|
33
33
|
<%% end %>
|
34
|
-
<%%= f.submit button_text, "data-reset-text"=>button_text, "data-loading-text"=>"Saving ...", :class=>"btn btn-primary
|
34
|
+
<%%= f.submit button_text, "data-reset-text"=>button_text, "data-loading-text"=>"Saving ...", :class=>"btn btn-primary ml-10" %>
|
35
35
|
</div>
|
36
36
|
<div class="cl-10"></div>
|
37
|
-
|
38
|
-
|
37
|
+
|
38
|
+
|
39
39
|
<%% end %>
|
40
40
|
|
41
41
|
<%%# Renders a partial which is used to create a new <%= instance_name %> %>
|
42
|
-
<%%= simple_form_for(<%= form_link_param %>, :html => {:class=>"form-vertical", :style => "
|
42
|
+
<%%= simple_form_for(<%= form_link_param %>, :html => {:class=>"form-vertical", :style => "m-bottom:0px;", :method => (@<%= instance_name %>.new_record? ? :post : :put), :remote=>true}) do |f| %>
|
43
43
|
=======
|
44
|
-
<%%= form_for(@<%= instance_name %>, :html => {:id=>"form_<%= instance_name %>", :class=>"
|
44
|
+
<%%= form_for(@<%= instance_name %>, :html => {:id=>"form_<%= instance_name %>", :class=>"mb-0", :method => (@<%= instance_name %>.new_record? ? :post : :put), :remote=>true}) do |f| %>
|
45
45
|
>>>>>>> External Changes
|
46
46
|
|
47
47
|
<%%= @<%= instance_name %>.errors[:base].to_sentence %>
|
48
|
-
|
48
|
+
|
49
49
|
<%%= hidden_field_tag :faction, @<%= instance_name %>.new_record? ? <%= instances_name %>_path : <%= instance_name %>_path(@<%= instance_name %>) %>
|
50
50
|
<%%= hidden_field_tag :fmethod, @<%= instance_name %>.new_record? ? "POST" : "PUT" %>
|
51
51
|
|
52
52
|
<div class="form-inputs">
|
53
|
-
|
53
|
+
|
54
54
|
<%- fields.each do |name, type| %>
|
55
55
|
<!-- <%= name.titleize -%> (<%= type -%>) -->
|
56
|
-
<%%= render :partial=>"field", :locals=>{:object=>@<%= instance_name %>,
|
57
|
-
:object_name=>'<%= instance_name %>',
|
58
|
-
:field_name=>'<%= name %>',
|
59
|
-
:display_name=>'<%= name.titleize %>',
|
60
|
-
:field_type=>'<%= type %>',
|
61
|
-
:input_type=>'<%= guess_input_type(name, type) %>',
|
62
|
-
:required=>true,
|
56
|
+
<%%= render :partial=>"field", :locals=>{:object=>@<%= instance_name %>,
|
57
|
+
:object_name=>'<%= instance_name %>',
|
58
|
+
:field_name=>'<%= name %>',
|
59
|
+
:display_name=>'<%= name.titleize %>',
|
60
|
+
:field_type=>'<%= type %>',
|
61
|
+
:input_type=>'<%= guess_input_type(name, type) %>',
|
62
|
+
:required=>true,
|
63
63
|
:place_holder=>"e.g: Put a suitable example here."} %>
|
64
64
|
<%- end -%>
|
65
|
-
|
65
|
+
|
66
66
|
</div>
|
67
|
-
|
67
|
+
|
68
68
|
<%% button_text = "#{@<%= instance_name %>.new_record? ? "Create" : "Update"} Item" %>
|
69
69
|
<div class="pull-right">
|
70
70
|
<%% if @<%= instance_name %>.new_record? %>
|
71
71
|
<%%= link_to "Cancel", "#", :class => "btn", :remote=>true %>
|
72
72
|
<%% else %>
|
73
|
-
<%%= link_to 'Back', <%= resource_link('index', 'path') %>, :class=>"btn
|
73
|
+
<%%= link_to 'Back', <%= resource_link('index', 'path') %>, :class=>"btn ml-10", :remote => true unless @<%= instance_name %>.new_record? %>
|
74
74
|
<%% end %>
|
75
|
-
<%%= f.submit button_text, "data-reset-text"=>button_text, "data-loading-text"=>"Saving ...", :class=>"btn btn-primary
|
75
|
+
<%%= f.submit button_text, "data-reset-text"=>button_text, "data-loading-text"=>"Saving ...", :class=>"btn btn-primary ml-10" %>
|
76
76
|
</div>
|
77
77
|
<div class="cl-10"></div>
|
78
|
-
|
79
|
-
|
78
|
+
|
79
|
+
|
80
80
|
<%% end %>
|
81
81
|
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_index.html.erb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
</div>
|
8
8
|
<%% end %>
|
9
9
|
<%% if @<%= instances_name %>.blank? %>
|
10
|
-
<div id="div_<%= instance_name %>_empty" class="box text-color-grey
|
10
|
+
<div id="div_<%= instance_name %>_empty" class="box text-color-grey p-80 text-align-center" style="height:200px;">
|
11
11
|
<%%= translate("forms.no_results_found") %>
|
12
12
|
</div>
|
13
13
|
<%% end %>
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_item.html.erb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
<%%# describes about each <%= instance_name %> %>
|
2
|
-
<div class="box hoverable
|
3
|
-
|
2
|
+
<div class="box hoverable p-10 box-border-black">
|
3
|
+
|
4
4
|
<div class="pull-left">
|
5
|
-
<%%= link_to <%= instance_name %>.<%= main_string_field %>, <%= resource_link('show', 'path') %>(<%= instance_name %>), :remote=>true, :class=>"text-color-blue
|
5
|
+
<%%= link_to <%= instance_name %>.<%= main_string_field %>, <%= resource_link('show', 'path') %>(<%= instance_name %>), :remote=>true, :class=>"text-color-blue fs-16" %></br>
|
6
6
|
</div>
|
7
|
-
<div class="pull-right text-color-red
|
7
|
+
<div class="pull-right text-color-red fs-12">
|
8
8
|
<%%= display_time(<%= instance_name %>.created_at) %>
|
9
9
|
</div>
|
10
|
-
|
10
|
+
|
11
11
|
<div class="cl"></div>
|
12
|
-
|
13
|
-
<div class="
|
12
|
+
|
13
|
+
<div class="p-5">
|
14
14
|
<%- text_fields.each do |name| -%>
|
15
15
|
<%%= scrap_word(<%= instance_name %>.<%= name %>, 200) %>
|
16
16
|
<%- end -%>
|
17
17
|
</div>
|
18
|
-
|
18
|
+
|
19
19
|
<div class="cl"></div>
|
20
|
-
|
20
|
+
|
21
21
|
</div>
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_nav_filters.html.erb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
<%%= link_to 'New <%= model_class %>', <%= resource_link('new', 'path') %>, :class=>"btn btn-mini btn-primary pull-right
|
1
|
+
<%%= link_to 'New <%= model_class %>', <%= resource_link('new', 'path') %>, :class=>"btn btn-mini btn-primary pull-right ml-10", :remote=>true %>
|
2
2
|
|
3
3
|
<%%# Used to add a search functionality %>
|
4
|
-
<%%= form_for <%= model_class %>.new, :url => <%= resource_link('index', 'path') %>, :method => :get, :remote=>true, :html=>{:class=>"pull-right", :style=>"
|
4
|
+
<%%= form_for <%= model_class %>.new, :url => <%= resource_link('index', 'path') %>, :method => :get, :remote=>true, :html=>{:class=>"pull-right", :style=>"m-bottom:0px;"} do |f| %>
|
5
5
|
<div class="input-append">
|
6
6
|
<input type="text" style="height:13px;width:120px;" name="<%= instance_name %>[query]">
|
7
|
-
<button type="submit" class="btn btn-mini btn-primary"><i class="icon-search icon-white
|
7
|
+
<button type="submit" class="btn btn-mini btn-primary"><i class="icon-search icon-white mr--5"></i>Search Item ...</button>
|
8
8
|
</div>
|
9
9
|
<%%- end %>
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_new.html.erb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
<%%# Used to create a new <%= model_class %> %>
|
3
|
-
<div class="box
|
4
|
-
<div class="
|
3
|
+
<div class="box p-10">
|
4
|
+
<div class="p-10 text-color-blue fs-18 mb-20">
|
5
5
|
Create a New <%= instance_title %>
|
6
6
|
</div>
|
7
7
|
<%%= render 'form' %>
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_show.html.erb
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
<%%= render :partial=>"layouts/common/flash_message" %>
|
6
6
|
<%% end %>
|
7
7
|
|
8
|
-
<div class="box
|
9
|
-
|
10
|
-
<div class="
|
8
|
+
<div class="box p-10">
|
9
|
+
|
10
|
+
<div class="m-10 text-color-blue fs-24">
|
11
11
|
<%%= @<%= instance_name %>.<%= main_string_field %> %>
|
12
12
|
</div>
|
13
|
-
|
13
|
+
|
14
14
|
<%- string_fields.each do |name| -%>
|
15
15
|
<%- next if name == main_string_field -%>
|
16
16
|
<div class="row">
|
@@ -18,29 +18,29 @@
|
|
18
18
|
<%%= content_tag :span, @<%= instance_name %>.<%= name %>, :class=>"six columns ext-color-grey" %>
|
19
19
|
</div>
|
20
20
|
<%- end -%>
|
21
|
-
|
21
|
+
|
22
22
|
<%- string_fields.each do |name| -%>
|
23
23
|
<% next if name == main_string_field %>
|
24
|
-
<div class="
|
24
|
+
<div class="ml-10">
|
25
25
|
<%= name.titleize %>: <%%= link_to @<%= instance_name %>.<%= name %>, "#", :class=>"text-color-red" %>
|
26
26
|
</div>
|
27
27
|
<%- end -%>
|
28
28
|
<% puts fields %>
|
29
29
|
<%- fields.map{|name, type| name unless ["text", "string"].include?(type)}.compact.uniq.each do |name| -%>
|
30
|
-
<div class="
|
30
|
+
<div class="ml-10">
|
31
31
|
<%= name.titleize %>: <%%= @<%= instance_name %>.<%= name %> %>
|
32
32
|
</div>
|
33
33
|
<%- end -%>
|
34
|
-
|
34
|
+
|
35
35
|
<%- text_fields.each do |name| -%>
|
36
|
-
<div class='italic
|
36
|
+
<div class='italic m-10'><%%= simple_format @<%= instance_name %>.<%= name %> %></div>
|
37
37
|
<%- end -%>
|
38
|
-
|
38
|
+
|
39
39
|
<div class="cl-20"></div>
|
40
|
-
|
41
|
-
<div class="palette-footer
|
40
|
+
|
41
|
+
<div class="palette-footer ml-10">
|
42
42
|
<%%= display_time(@<%= instance_name %>.created_at, "pull-left text-color-grey") %>
|
43
|
-
<%%= link_to raw("<i class=\"icon-pencil icon-white
|
43
|
+
<%%= link_to raw("<i class=\"icon-pencil icon-white mr--5\"></i> Edit"), <%= resource_link('edit', 'path') %>(@<%= instance_name %>), :class=>"btn btn-inverse btn-mini pull-right ml-10", :remote=>true %>
|
44
44
|
<%%= link_to raw("<i class=\"icon-remove \"></i> Delete"), <%= resource_link('destroy', 'path') %>(@<%= instance_name %>), method: :delete, data: { confirm: 'Are you sure?' }, :class=>"btn btn-mini pull-right", :remote=>true %>
|
45
45
|
<div class="cl-10"></div>
|
46
46
|
</div>
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_summary.html.erb
CHANGED
@@ -5,6 +5,6 @@
|
|
5
5
|
<%%= render :partial=>"layouts/common/flash_message" %>
|
6
6
|
<%% end %>
|
7
7
|
|
8
|
-
<div class="box text-color-grey
|
8
|
+
<div class="box text-color-grey p-80 text-align-center" style="height:200px;">
|
9
9
|
Total <%= instances_title %> = <%%= <%= model_class %>.count %>
|
10
10
|
</div>
|
data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/index.html.erb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
<%%# Displays to Manage the items %>
|
3
|
-
<div class="<%= row_class %>
|
4
|
-
<div class="
|
3
|
+
<div class="<%= row_class %> pt-10 ml-0">
|
4
|
+
<div class="fs-22 pull-left">Manage <%= model_class.pluralize %></div>
|
5
5
|
<div id="div_<%= instance_name %>_filters pull-right">
|
6
6
|
<%%= render :partial=>"filters" %>
|
7
7
|
</div>
|
@@ -17,17 +17,17 @@
|
|
17
17
|
<%% case params[:action] %>
|
18
18
|
<%% when "new", "edit", "show" %>
|
19
19
|
<%%= render :partial=>params[:action] %>
|
20
|
-
<%% when "index" %>
|
20
|
+
<%% when "index" %>
|
21
21
|
<%% if @<%= instances_name %>.empty? %>
|
22
22
|
<%%= render :partial=>"summary" %>
|
23
23
|
<%% else %>
|
24
|
-
<%%= render :partial=>"show" %>
|
24
|
+
<%%= render :partial=>"show" %>
|
25
25
|
<%% end %>
|
26
26
|
<%% else %>
|
27
|
-
<%%= render :partial=>"summary" %>
|
27
|
+
<%%= render :partial=>"summary" %>
|
28
28
|
<%% end %>
|
29
29
|
</div>
|
30
|
-
|
30
|
+
|
31
31
|
</div>
|
32
32
|
|
33
33
|
|
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
// Fill the right box with first <%= instance_name %> details in the list
|
4
4
|
$('#div_<%= instance_name %>_details').html("<%%= escape_javascript(render(:partial=>'show')) %>");
|
5
|
-
|
5
|
+
|
6
6
|
// Rendering the item list
|
7
7
|
$('#div_<%= instance_name %>_collections').html("<%%= escape_javascript(render(:partial=>"index")) %>");
|
8
|
-
|
8
|
+
|
9
9
|
<%% else %>
|
10
10
|
|
11
|
-
var noResultsText = "<div class='box
|
11
|
+
var noResultsText = "<div class='box p-10' style='height:200px;'>No results found.</div>";
|
12
12
|
$('#div_<%= instance_name %>_list').html(noResultsText);
|
13
13
|
$('#div_<%= instance_name %>_list').html(noResultsText);
|
14
14
|
|