humdrum-rails 0.0.9 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +4 -1
  3. data/humdrum-rails.gemspec +10 -13
  4. data/lib/humdrum/version.rb +1 -1
  5. data/lib/rails/generators/humdrum/layout/layout_generator.rb +2 -1
  6. data/lib/rails/generators/humdrum/layout/templates/helpers/image_helper.rb +30 -0
  7. data/lib/rails/generators/humdrum/layout/templates/javascripts/validations/bootstrap3/main.js +25 -1
  8. data/lib/rails/generators/humdrum/layout/templates/stylesheets/bootstrap3/overrides-bootstrap.css +10 -5
  9. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap2/layouts/application.html.erb +0 -3
  10. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap2/layouts/layout_name.html.erb +0 -3
  11. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/application.html.erb +0 -3
  12. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/common/_flash_message.html.erb +8 -9
  13. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/common/_overlays.html.erb +1 -7
  14. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/layout_name.html.erb +0 -3
  15. data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/application.html.erb +0 -3
  16. data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/layout_name.html.erb +0 -3
  17. data/lib/rails/generators/humdrum/resource/resource_generator.rb +1 -0
  18. data/lib/rails/generators/humdrum/resource/templates/controllers/resource_controller.rb +4 -12
  19. data/lib/rails/generators/humdrum/resource/templates/javascripts/validations/bootstrap3/validator.js +2 -1
  20. data/lib/rails/generators/humdrum/resource/templates/models/resource.rb +15 -0
  21. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_drop_down.html.erb +12 -0
  22. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_field.html.erb +1 -1
  23. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_filters.html.erb +2 -2
  24. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_item.html.erb +15 -13
  25. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_show.html.erb +27 -4
  26. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/create.js.erb +4 -4
  27. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/destroy.js.erb +17 -8
  28. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/edit.js.erb +1 -1
  29. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/index.html.erb +13 -5
  30. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/index.js.erb +4 -3
  31. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/new.js.erb +2 -2
  32. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/update.js.erb +4 -4
  33. data/lib/rails/generators/humdrum/setup/templates/config/locales/humdrum.en.yml +24 -2
  34. metadata +50 -49
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 764beace85244b2583970dbea418f50cf1f11d95
4
+ data.tar.gz: a6e93f7058738cb5668714a52c739a213560c413
5
+ SHA512:
6
+ metadata.gz: d7efb9457f659673b9357061d629f13bd67f9afaf4be318440c97a0cabb696f1127062b9a19cccdbecb828ade5d21e09a34b814b21712faf9a2120b222f62e2f
7
+ data.tar.gz: 80870b78984aefbd2fdd8b8dbb7ec1d25600584289f0198468cc0d9c74eb8e7e19f175de74184c84210550a89d9e007b902447703a7c5ad40bb59318e84fdc9c
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Humdrum
2
2
 
3
- humdrum is a collection of useful generators which are quite handy for starting up a project in ruby on rails. humdrum creates layouts using bootstrap, HTML5boilerplate, modernizer etc to kick start a project.
3
+ humdrum is a collection of useful generators which are quite handy for starting up a project in ruby on rails. humdrum creates layouts using bootstrap, HTML5boilerplate etc to kick start a project.
4
4
 
5
5
  ## Installation
6
6
 
@@ -27,3 +27,6 @@ TODO: Write usage instructions here
27
27
  3. Commit your changes (`git commit -am 'Add some feature'`)
28
28
  4. Push to the branch (`git push origin my-new-feature`)
29
29
  5. Create new Pull Request
30
+
31
+ 1. gem build humdrum-rails.gemspec
32
+ 2. gem push humdrum-rails-0.1.0.gem
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'humdrum/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
-
7
+
8
8
  gem.name = "humdrum-rails"
9
9
  gem.email = "krishnaprasadvarma@gmail.com"
10
10
  gem.version = Humdrum::VERSION
@@ -13,21 +13,18 @@ Gem::Specification.new do |gem|
13
13
  gem.license = "MIT"
14
14
  gem.homepage = "http://github.com/humdrum"
15
15
  gem.description = %q{humdrum-rails is a collection of useful generators which are quite handy for starting up a project in ruby on railgem.}
16
- gem.summary = %q{humdrum-rails creates layouts using bootstrap, HTML5boilerplate, modernizer etc to kick start a project.}
17
-
16
+ gem.summary = %q{humdrum-rails creates layouts using bootstrap, HTML5boilerplate etc to kick start a project.}
17
+
18
18
  gem.rubyforge_project = "humdrum"
19
-
19
+
20
20
  gem.files = `git ls-files`.split("\n")
21
21
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
22
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
23
23
  gem.require_paths = ["lib"]
24
-
25
- gem.add_runtime_dependency(%q<colorize>, ["~> 0.5.8"])
26
-
27
- gem.add_development_dependency 'rails', '~> 3.0.0'
28
- gem.add_development_dependency 'rainbow'
29
- gem.add_development_dependency 'rainbow'
30
- gem.add_development_dependency 'handy-css-rails', '0.0.4'
31
-
32
-
24
+
25
+ gem.add_runtime_dependency 'colorize', '~> 0.7', '>= 0.7.3'
26
+ gem.add_development_dependency 'rails', '~> 3.0', '>= 3.0.0'
27
+ gem.add_development_dependency 'rainbow', '~> 1.1.4', '>= 1.1.4'
28
+ gem.add_development_dependency 'handy-css-rails', '~> 0.0.5', '>= 0.0.5'
29
+
33
30
  end
@@ -1,4 +1,4 @@
1
1
  module Humdrum
2
2
  # http://semver.org/
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.1"
4
4
  end
@@ -79,7 +79,7 @@ module Humdrum
79
79
  unless options.skip_javascript?
80
80
  template "javascripts/application.js", "app/assets/javascripts/application.js"
81
81
  template "javascripts/validations/#{framework}/main.js", "app/assets/javascripts/validations/main.js"
82
- copy_file "javascripts/modernizr.2.6.2.js", "app/assets/javascripts/modernizr.2.6.2.js"
82
+ #copy_file "javascripts/modernizr.2.6.2.js", "app/assets/javascripts/modernizr.2.6.2.js"
83
83
  case framework
84
84
  when "bootstrap3"
85
85
  copy_file "javascripts/bootstrap3/bootstrap.min.js", "app/assets/javascripts/bootstrap.min.js"
@@ -112,6 +112,7 @@ module Humdrum
112
112
  end
113
113
 
114
114
  def generate_helpers
115
+ template "helpers/image_helper.rb", "app/helpers/image_helper.rb"
115
116
  template "helpers/title_helper.rb", "app/helpers/title_helper.rb"
116
117
  template "helpers/navigation_helper.rb", "app/helpers/navigation_helper.rb"
117
118
  template "helpers/meta_tags_helper.rb", "app/helpers/meta_tags_helper.rb"
@@ -0,0 +1,30 @@
1
+ module ImageHelper
2
+
3
+ def display_image(object, photo_association_name=:photo, width=80)
4
+
5
+ if width.is_a?(String)
6
+ if width.include?("px")
7
+ width_val = width.split("px").first
8
+ elsif width.include?("%")
9
+ width_val = width.split("%").first
10
+ else
11
+ width_val = width.to_i
12
+ end
13
+ width_string = width
14
+ else
15
+ width_val = width
16
+ width_string = "#{width.to_i}px"
17
+ end
18
+
19
+ if object.respond_to?(photo_association_name) && object.send(photo_association_name)
20
+ return image_tag object.send(photo_association_name).image_url, :style=>"width:#{width_string};"
21
+ else
22
+ return image_tag "http://placehold.it/#{width_val}x#{width_val}", :class=>"img-thumbnail"
23
+ end
24
+ end
25
+
26
+ def display_photo(photo, width=100)
27
+ return image_tag photo.image_url, :style=>"width:#{width}px;", :width=>"#{width}", :class=>"img-thumbnail"
28
+ end
29
+
30
+ end
@@ -1,4 +1,4 @@
1
- function populateServerSideErrors(instanceName, errorMessages) {
1
+ function populateServerSideErrorsInDetailsBox(instanceName, errorMessages) {
2
2
 
3
3
  // Removing the old server validation errors if any
4
4
  $("#div_"+ instanceName +"_server_validation_errors").remove();
@@ -13,3 +13,27 @@ function populateServerSideErrors(instanceName, errorMessages) {
13
13
  });
14
14
 
15
15
  }
16
+
17
+ function populateServerSideErrorsInOverlay(instanceName, errorMessages) {
18
+
19
+ // Removing the old server validation errors if any
20
+ $("#div_"+ instanceName +"_server_validation_errors").remove();
21
+ $("#div_"+ instanceName +"_js_validation_error").remove();
22
+
23
+ // Creating a div to hold multiple error messages.
24
+ errorMessageHolder = "<div id='div_"+ instanceName +"_server_validation_errors' style=\"margin-bottom:5px;\"></div>"
25
+ $("#div_modal_generic div.modal-body-main").prepend(errorMessageHolder);
26
+
27
+ jQuery.each(errorMessages, function(i, message) {
28
+ errorHtml = "<div class=\"alert alert-danger\" data-alert=\"alert\" style=\"margin-bottom:5px;\">"+ message +"</div>"
29
+ $("#div_"+ instanceName +"_server_validation_errors").prepend(errorHtml);
30
+ });
31
+
32
+ }
33
+
34
+ function populateServerSideErrors(instanceName, errorMessages) {
35
+
36
+ populateServerSideErrorsInOverlay(instanceName, errorMessages);
37
+
38
+ }
39
+
@@ -1,7 +1,12 @@
1
- body {
2
- padding: 30px;
3
- }
1
+ body { padding: 30px; }
4
2
 
5
- .navbar {
6
- margin-bottom: 30px;
3
+ .navbar { margin-bottom: 0px; }
4
+
5
+ .alert { padding:10px; }
6
+
7
+ .container {
8
+ padding-right: 5px;
9
+ padding-left: 5px;
10
+ margin-right: auto;
11
+ margin-left: auto;
7
12
  }
@@ -15,9 +15,6 @@
15
15
  <%%= stylesheet_link_tag "application", :media => "all" -%>
16
16
 
17
17
  <%%= csrf_meta_tags -%>
18
-
19
- <%%# Modernizr should be loaded first %>
20
- <script src="/assets/modernizr.2.6.2.js"></script>
21
18
 
22
19
  </head>
23
20
 
@@ -16,9 +16,6 @@
16
16
 
17
17
  <%%= csrf_meta_tags -%>
18
18
 
19
- <%%# Modernizr should be loaded first %>
20
- <script src="/assets/modernizr.2.6.2.js"></script>
21
-
22
19
  </head>
23
20
 
24
21
  <body>
@@ -16,9 +16,6 @@
16
16
 
17
17
  <%%= csrf_meta_tags -%>
18
18
 
19
- <%%# Modernizr should be loaded first %>
20
- <script src="/assets/modernizr.2.6.2.js"></script>
21
-
22
19
  </head>
23
20
 
24
21
  <body>
@@ -1,23 +1,22 @@
1
-
2
- <%# Used to render a unique flash message styling %>
3
1
  <%%
4
2
  if request.xhr?
5
- flash_message = flash.now[:success] || flash.now[:notice] || flash.now[:alert]
3
+ flash_message = flash.now[:success] || flash.now[:notice] || flash.now[:alert] || flash.now[:error]
6
4
  style_classes = ""
7
5
  else
8
- style_classes = "margin-top-10 margin-bottom-5 margin-left-40 margin-right-40"
9
- flash_message = flash[:success] || flash[:notice] || flash[:alert]
6
+ style_classes = ""
7
+ flash_message = flash[:success] || flash[:notice] || flash[:alert] || flash[:error]
10
8
  end
11
- cls_name = "alert"
9
+ cls_name = "alert-info"
12
10
  cls_name = 'alert-success' if flash.now[:success] || flash[:success]
13
- cls_name = 'alert-notice' if flash.now[:notice] || flash[:notice]
14
- cls_name = 'alert-error' if flash.now[:alert] || flash[:alert]
11
+ cls_name = 'alert-warning' if flash.now[:alert] || flash[:alert]
12
+ cls_name = 'alert-danger' if flash.now[:error] || flash[:error]
15
13
 
16
14
  flash_message = flash_message.strip if flash_message
17
15
 
18
16
  %>
17
+
19
18
  <%% unless flash_message.blank? %>
20
- <div class="<%%= style_classes %> alert <%%= cls_name %> fade in" data-alert="alert" style="margin-bottom:5px;">
19
+ <div class="<%%= style_classes %> alert <%%= cls_name %> fade in margin-bottom-10" data-alert="alert">
21
20
  <a class="close" data-dismiss='alert' href="#">×</a>
22
21
  <p><%%= flash_message %></p>
23
22
  </div>
@@ -6,13 +6,7 @@
6
6
  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
7
7
  <h4 class="modal-title">Modal title</h4>
8
8
  </div>
9
- <div class="modal-body">
10
- <p>One fine body&hellip;</p>
11
- </div>
12
- <div class="modal-footer">
13
- <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
14
- <button type="button" class="btn btn-primary">Save changes</button>
15
- </div>
9
+ <div class="modal-body-main"></div>
16
10
  </div><!-- /.modal-content -->
17
11
  </div><!-- /.modal-dialog -->
18
12
  </div><!-- /.modal -->
@@ -16,9 +16,6 @@
16
16
 
17
17
  <%%= csrf_meta_tags -%>
18
18
 
19
- <%%# Modernizr should be loaded first %>
20
- <script src="/assets/modernizr.2.6.2.js"></script>
21
-
22
19
  </head>
23
20
 
24
21
  <body>
@@ -16,9 +16,6 @@
16
16
 
17
17
  <%%= csrf_meta_tags -%>
18
18
 
19
- <%%# Modernizr should be loaded first -%>
20
- <script src="/assets/modernizr.2.6.2.js"></script>
21
-
22
19
  </head>
23
20
 
24
21
  <body>
@@ -16,9 +16,6 @@
16
16
 
17
17
  <%%= csrf_meta_tags -%>
18
18
 
19
- <%%# Modernizr should be loaded first -%>
20
- <script src="/assets/modernizr.2.6.2.js"></script>
21
-
22
19
  </head>
23
20
 
24
21
  <body>
@@ -41,6 +41,7 @@ module Humdrum
41
41
  template "views/#{framework}/resource/_field.html.erb", "app/views/#{controller_path}/_field.html.erb"
42
42
  template "views/#{framework}/resource/_form.html.erb", "app/views/#{controller_path}/_form.html.erb"
43
43
  template "views/#{framework}/resource/_index.html.erb", "app/views/#{controller_path}/_index.html.erb"
44
+ template "views/#{framework}/resource/_drop_down.html.erb", "app/views/#{controller_path}/_drop_down.html.erb"
44
45
  template "views/#{framework}/resource/_item.html.erb", "app/views/#{controller_path}/_item.html.erb"
45
46
  template "views/#{framework}/resource/_nav_filters.html.erb", "app/views/#{controller_path}/_nav_filters.html.erb"
46
47
  template "views/#{framework}/resource/_new.html.erb", "app/views/#{controller_path}/_new.html.erb"
@@ -150,10 +150,11 @@ class <%= controller_class %> < ApplicationController
150
150
  respond_to do |format|
151
151
  ## Destroying the <%= instance_name %>
152
152
  @<%= instance_name %>.destroy
153
-
153
+ @<%= instance_name %> = <%= model_class %>.new
154
+
154
155
  # Fetch the <%= instances_name %> to refresh ths list and details box
155
156
  get_collections
156
- @<%= instance_name %> = @<%= instances_name %>.first
157
+ @<%= instance_name %> = @<%= instances_name %>.first if @<%= instances_name %> and @<%= instances_name %>.any?
157
158
 
158
159
  # Setting the flash message
159
160
  message = translate("forms.destroyed_successfully", :item => "<%= instance_name.titleize %>")
@@ -181,16 +182,7 @@ class <%= controller_class %> < ApplicationController
181
182
 
182
183
  if params[:query]
183
184
  @query = params[:query].strip
184
- if !@query.blank?
185
- relation = relation.where("
186
- <% string_fields_including_main_field.each_with_index do |sfield, i| -%>
187
- <% if string_fields_including_main_field.size - 1 != i -%>
188
- LOWER(<%= sfield %>) LIKE LOWER('%#{@query}%') OR\
189
- <% else -%>
190
- LOWER(<%= sfield %>) LIKE LOWER('%#{@query}%')")
191
- <% end -%>
192
- <% end -%>
193
- end
185
+ relation = relation.search(@query) if !@query.blank?
194
186
  end
195
187
 
196
188
  @<%= instances_name %> = relation.order("created_at desc").page(@current_page).per(@per_page)
@@ -58,7 +58,8 @@ function validate<%= model_class %>Form() {
58
58
  $("#div_<%= instance_name %>_js_validation_error").remove();
59
59
 
60
60
  errorHtml = "<div id='div_<%= instance_name %>_js_validation_error' class=\"alert alert-danger\" data-alert=\"alert\" style=\"margin-bottom:5px;\">"+ errorMessage +"</div>"
61
- $("#div_<%= instance_name %>_details").prepend(errorHtml);
61
+ //$("#div_<%= instance_name %>_details").prepend(errorHtml);
62
+ $("#div_modal_generic div.modal-body-main").prepend(errorHtml);
62
63
 
63
64
  // Show error labels
64
65
  $("div.error").show();
@@ -34,4 +34,19 @@ class <%= model_class %> < ActiveRecord::Base
34
34
  #belongs_to :user, foreign_key: :owner_id
35
35
  #has_many :products
36
36
 
37
+ # return an active record relation object with the search query in its where clause
38
+ # Return the ActiveRecord::Relation object
39
+ # == Examples
40
+ # >>> <%= instance_name %>.search(query)
41
+ # => ActiveRecord::Relation object
42
+ scope :search, lambda {|query| where("
43
+ <% string_fields_including_main_field.each_with_index do |sfield, i| -%>
44
+ <% if string_fields_including_main_field.size - 1 != i -%>
45
+ LOWER(<%= sfield %>) LIKE LOWER('%#{query}%') OR\
46
+ <% else -%>
47
+ LOWER(<%= sfield %>) LIKE LOWER('%#{query}%')")
48
+ <% end -%>
49
+ <% end -%>
50
+ }
51
+
37
52
  end
@@ -0,0 +1,12 @@
1
+ <div class="btn-group margin-top-10 margin-bottom-10" style="width:100%;">
2
+ <button type="button" class="btn btn-default btn-block dropdown-toggle" data-toggle="dropdown">
3
+ Choose a <%= model_class.titleize %> <span class="caret"></span>
4
+ </button>
5
+ <ul class="dropdown-menu" role="menu">
6
+ <%% @<%= instances_name %>.each do |<%= instance_name %>| %>
7
+ <li><%%= link_to <%= instance_name %>.name, <%= resource_link('show', 'path') %>(<%= instance_name %>), :remote=>true %></li>
8
+ <%% end %>
9
+ <%%= content_tag :li, link_to_next_page(@<%= instances_name %>, 'Next Page', :remote => true) %>
10
+ <%%= content_tag :li, link_to_previous_page(@<%= instances_name %>, 'Previous Page', :remote => true) %>
11
+ </ul>
12
+ </div>
@@ -38,7 +38,7 @@
38
38
  <span class="text-color-red margin-left-10 margin-right-5 pull-right"><%%= required ? "*" : raw("&nbsp;&nbsp;") %></span>
39
39
  </label>
40
40
  <div class="col-md-8">
41
- <textarea name="<%%= object_name %>[<%%= field_name %>]" class="textarea input form-control" id="inp_<%%= display_name.underscore.split(" ").join("_") %> placeholder="<%%= place_holder %>" "><%%= object.send(field_name.to_s) %></textarea>
41
+ <textarea name="<%%= object_name %>[<%%= field_name %>]" style="height:200px;" class="textarea input form-control" id="inp_<%%= display_name.underscore.split(" ").join("_") %> placeholder="<%%= place_holder %>" "><%%= object.send(field_name.to_s) %></textarea>
42
42
  </div>
43
43
 
44
44
  <%% end %>
@@ -1,9 +1,9 @@
1
1
  <div class="row">
2
- <div class="col-md-4">
2
+ <div class="col-xs-4">
3
3
  <%%= link_to raw("<i class='icon-plus icon-white margin-right-5'></i> New <%= model_class.titleize %>"), <%= resource_link('new', 'path') %>, :class=>"btn btn-warning", :remote=>true %>
4
4
  </div><!-- /.col-xs-6 -->
5
5
 
6
- <div class="col-md-8">
6
+ <div class="col-xs-8">
7
7
 
8
8
  <%%= form_for <%= model_class %>.new, :url => <%= resource_link('index', 'path') %>, :method => :get, :remote=>true, :html=>{:class=>"pull-right", :style=>"margin-bottom:0px;"} do |f| %>
9
9
 
@@ -1,21 +1,23 @@
1
1
  <%%# describes about each <%= instance_name %> %>
2
2
  <div class="box hoverable padding-10 box-border-black">
3
3
 
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 font-size-16" %></br>
6
- </div>
7
- <div class="pull-right text-color-red font-size-12">
8
- <%%= display_time(<%= instance_name %>.created_at) %>
4
+ <div class="row">
5
+ <div class="col-md-4 visible-md visible-lg">
6
+ <%%= display_image(<%= instance_name %>, :photo, "100%") %>
7
+ </div>
8
+ <div class="col-md-8">
9
+ <%%= link_to <%= instance_name %>.name, <%= resource_link('show', 'path') %>(<%= instance_name %>),
10
+ :remote=>true, :class=>"text-color-blue font-size-16" %><br/>
11
+ <div class="text-color-gray font-size-12"><%%#= scrap_word(<%= instance_name %>.<%= text_fields.any? ? text_fields.first : "description" %>, 160) %></div>
12
+ </div>
9
13
  </div>
10
14
 
11
- <div class="cl"></div>
12
-
13
- <div class="padding-5">
14
- <%- text_fields.each do |name| -%>
15
- <%%= scrap_word(<%= instance_name %>.<%= name %>, 200) %>
16
- <%- end -%>
17
- </div>
15
+ <div class="margin-top-10 pull-right text-color-gray font-size-11 visible-md visible-lg">
16
+ <%%= display_time(<%= instance_name %>.created_at) %>
17
+ </div>
18
18
 
19
19
  <div class="cl"></div>
20
+
20
21
 
21
- </div>
22
+ </div>
23
+
@@ -7,9 +7,33 @@
7
7
 
8
8
  <div class="box padding-10">
9
9
 
10
- <div class="margin-10 text-color-blue font-size-24">
11
- <%%= @<%= instance_name %>.<%= main_string_field %> %>
12
- </div>
10
+ <div class="row">
11
+ <div class="col-md-2">
12
+ <%%#= display_image(@<%= instance_name %>) %>
13
+ </div>
14
+
15
+ <div class="col-md-10">
16
+ <div class="margin-left-10 text-color-blue font-size-24"><%%#= @<%= instance_name %>.display_name %></div>
17
+ <div class="text-color-red font-size-16 margin-left-10"><%%#= @<%= instance_name %>.user_type %></div>
18
+ </div>
19
+ </div>
20
+
21
+ <table class="table table-condensed table-hover table-striped margin-top-20">
22
+ <tbody>
23
+ <tr>
24
+ <td class="bold" style="width:30%;">Id</td>
25
+ <td><%%= @<%= instance_name %>.id %></td>
26
+ </tr>
27
+ <tr>
28
+ <td class="bold" style="width:30%;">Created at</td>
29
+ <td><%%= display_time(@<%= instance_name %>.created_at, "text-color-grey") %></td>
30
+ </tr>
31
+ <tr>
32
+ <td class="bold" style="width:30%;">Last updated at</td>
33
+ <td><%%= display_time(@<%= instance_name %>.updated_at, "text-color-grey") %></td>
34
+ </tr>
35
+ </tbody>
36
+ </table>
13
37
 
14
38
  <%- string_fields.each do |name| -%>
15
39
  <%- next if name == main_string_field -%>
@@ -33,7 +57,6 @@
33
57
  <div class="cl-20"></div>
34
58
 
35
59
  <div class="palette-footer margin-left-10">
36
- <%%= display_time(@<%= instance_name %>.created_at, "pull-left text-color-grey") %>
37
60
  <%%= link_to raw("<i class=\"icon-pencil icon-white margin-right-5\"></i> Edit"), <%= resource_link('edit', 'path') %>(@<%= instance_name %>), :class=>"btn btn-default btn-xs pull-right margin-left-10", :remote=>true %>
38
61
  <%%= 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-danger btn-xs pull-right", :remote=>true %>
39
62
  <div class="cl-10"></div>
@@ -12,10 +12,10 @@
12
12
 
13
13
  <%% else %>
14
14
 
15
- // Reload the form partial to display errors
16
- $('#div_<%= instance_name %>_details').html("<%%= escape_javascript(render(:partial=>'new')) %>");
17
-
18
- // Validate the form
15
+ // Show the new form in the pop up form.
16
+ heading = "Create <%= model_class.titleize %>";
17
+ bodyContent = "<%%= escape_javascript(render(:partial=>"form")) %>";
18
+ showModal(heading, bodyContent);
19
19
  validate<%= model_class %>Form();
20
20
 
21
21
  // Populate Server Side Errors
@@ -1,14 +1,23 @@
1
- <%% if @<%= instance_name %>.errors.blank? %>
1
+ <%% if @<%= instance_name %> %>
2
+ <%% if @<%= instance_name %>.new_record? %>
2
3
 
3
- // Fill the right box with first <%= instance_name %> details
4
- $('#div_<%= instance_name %>_details').html("<%%= escape_javascript(render(:partial=>'show')) %>");
4
+ // Fill the right box with first <%= instance_name %> details
5
+ $('#div_<%= instance_name %>_details').html("<%%= escape_javascript(render(:partial=>'summary')) %>");
5
6
 
6
- // Render health care <%= instances_name %> List
7
+ <%% else %>
8
+
9
+ // Render the show partial to show flash message
10
+ $('#div_<%= instance_name %>_details').html("<%%= escape_javascript(render(:partial=>'show')) %>");
11
+
12
+ <%% end %>
13
+
14
+ // Render <%= instances_name %> List
7
15
  $('#div_<%= instance_name %>_collections').html("<%%= escape_javascript(render(:partial=>'index')) %>");
8
16
 
9
17
  <%% else %>
10
-
11
- // Render the show partial to show flash message
12
- $('#div_<%= instance_name %>_details').html("<%%= escape_javascript(render(:partial=>'show')) %>");
13
-
18
+
19
+ var noResultsText = "<div id=\"div_admin_empty\" class=\"box text-color-grey padding-80 text-align-center\" style=\"height:200px;\"><%%= translate("forms.no_results_found") %></div>";
20
+ $('#div_<%= instance_name %>_index').html(noResultsText);
21
+ $('#div_<%= instance_name %>_details').html(noResultsText);
22
+
14
23
  <%% end %>
@@ -1,5 +1,5 @@
1
1
  // Show the edit form in the right box.
2
- heading = "Edit <%= model_class.titlize %>";
2
+ heading = "Edit <%= model_class.titleize %>";
3
3
  bodyContent = "<%%= escape_javascript(render(:partial=>"form")) %>";
4
4
  showModal(heading, bodyContent);
5
5
  validate<%= model_class %>Form();
@@ -1,19 +1,27 @@
1
1
 
2
+ <div class="cl-10 hidden-xs"></div>
3
+
2
4
  <%%# Displays to Manage the items %>
3
- <div class="<%= row_class %> padding-top-10 margin-left-0 margin-bottom-20">
4
- <div class="font-size-22 col-md-6">Manage <%= model_class.pluralize %></div>
5
- <div id="div_<%= instance_name %>_filters" class="col-md-6">
5
+ <div class="<%= row_class %> margin-bottom-10">
6
+ <div class="font-size-22 col-sm-6 hidden-xs">Manage <%= model_class.pluralize %></div>
7
+ <div class="font-size-22 col-sm-6 text-align-center visible-xs">Manage <%= model_class.pluralize %></div>
8
+ <div id="div_<%= instance_name %>_filters" class="col-sm-6 hidden-xs">
6
9
  <%%= render :partial=>"filters" %>
7
10
  </div>
8
11
  </div>
9
12
 
13
+ <div class="cl-10 hidden-xs"></div>
14
+
10
15
  <%%# Renders a partial to display all the <%= instances_name %> %>
11
16
  <div class="<%= row_class %>">
12
- <div id="div_<%= instance_name %>_index" class="col-md-6">
17
+ <div id="div_<%= instance_name %>_index" class="col-sm-6 hidden-xs">
13
18
  <%%= render :partial=>"index" %>
14
19
  </div>
20
+ <div id="div_<%= instance_name %>_drop_down" class="col-xs-12 visible-xs">
21
+ <%%= render :partial=>"drop_down" %>
22
+ </div>
15
23
 
16
- <div id="div_<%= instance_name %>_details" class="col-md-6">
24
+ <div id="div_<%= instance_name %>_details" class="col-xs-12 col-sm-6">
17
25
  <%% case params[:action] %>
18
26
  <%% when "new", "edit", "show" %>
19
27
  <%%= render :partial=>params[:action] %>
@@ -5,11 +5,12 @@
5
5
 
6
6
  // Rendering the item list
7
7
  $('#div_<%= instance_name %>_index').html("<%%= escape_javascript(render(:partial=>"index")) %>");
8
+ $('#div_<%= instance_name %>_drop_down').html("<%%= escape_javascript(render(:partial=>"drop_down")) %>");
8
9
 
9
10
  <%% else %>
10
11
 
11
- var noResultsText = "<div class='box padding-10' style='height:200px;'>No results found.</div>";
12
- $('#div_<%= instance_name %>_list').html(noResultsText);
13
- $('#div_<%= instance_name %>_list').html(noResultsText);
12
+ var noResultsText = "<div id=\"div_admin_empty\" class=\"box text-color-grey padding-80 text-align-center\" style=\"height:200px;\"><%%= translate("forms.no_results_found") %></div>";
13
+ $('#div_<%= instance_name %>_index').html(noResultsText);
14
+ $('#div_<%= instance_name %>_details').html(noResultsText);
14
15
 
15
16
  <%% end %>
@@ -1,5 +1,5 @@
1
- // Show the new form in the right box.
2
- heading = "Create <%= model_class.titlize %>";
1
+ // Show the new form in the pop up form.
2
+ heading = "Create <%= model_class.titleize %>";
3
3
  bodyContent = "<%%= escape_javascript(render(:partial=>"form")) %>";
4
4
  showModal(heading, bodyContent);
5
5
  validate<%= model_class %>Form();
@@ -11,10 +11,10 @@
11
11
 
12
12
  <%% else %>
13
13
 
14
- // Reload the form partial to display errors
15
- $('#div_<%= instance_name %>_details').html("<%%= escape_javascript(render(:partial=>"edit")) %>");
16
-
17
- // Validate the form
14
+ // Show the new form in the pop up form.
15
+ heading = "Edit <%= model_class.titleize %>";
16
+ bodyContent = "<%%= escape_javascript(render(:partial=>"form")) %>";
17
+ showModal(heading, bodyContent);
18
18
  validate<%= model_class %>Form();
19
19
 
20
20
  // Populate Server Side Errors
@@ -1,6 +1,28 @@
1
1
  en:
2
2
  forms:
3
3
  created_successfully: "%{item} has been created successfully."
4
+ failed_to_create: "Failed to create %{item}."
4
5
  updated_successfully: "%{item} has been updated successfully."
5
- destroyed_successfully: "%{item} has been removed successfully."
6
- no_results_found: "No results found."
6
+ failed_to_update: "Failed to update %{item}."
7
+ removed_successfully: "%{item} has been removed successfully."
8
+ failed_to_remove: "Failed to remove %{item}."
9
+ no_results_found: "No results found."
10
+ destroyed_successfully: "%{item} destroyed successfully"
11
+ authentication:
12
+ error: "Error!"
13
+ success: "Success!"
14
+ permission_denied: "Permission Denied: You don't have permission to perform this action"
15
+ invalid_token: "Invalid Token: You don't have permission to perform this action"
16
+ user_not_found: "Invalid Login"
17
+ invalid_login: "Invalid Login"
18
+ user_is_pending: "Your account is not yet approved, please contact administrator"
19
+ user_is_locked: "Your account is locked, please contact administrator"
20
+ user_is_blocked: "Your account is blocked, please contact administrator"
21
+ logged_in_successfully: "You have successfully logged in"
22
+ logged_out_successfully: "You have successfully logged out"
23
+ login: "Sign in"
24
+ logout: "Sign out"
25
+ status:
26
+ internal_server_error: "500 Something went wrong"
27
+ forbidden: "403 Permission Denied! You don't have permission to perform this action"
28
+ not_found: "404 Not Found: We don't have what you are looking for"
metadata CHANGED
@@ -1,96 +1,95 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: humdrum-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Krishnan
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-12 00:00:00.000000000 Z
11
+ date: 2014-09-08 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: colorize
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: 0.5.8
19
+ version: '0.7'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.7.3
22
23
  type: :runtime
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
26
  requirements:
27
- - - ~>
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.7'
30
+ - - ">="
28
31
  - !ruby/object:Gem::Version
29
- version: 0.5.8
32
+ version: 0.7.3
30
33
  - !ruby/object:Gem::Dependency
31
34
  name: rails
32
35
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
36
  requirements:
35
- - - ~>
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.0'
40
+ - - ">="
36
41
  - !ruby/object:Gem::Version
37
42
  version: 3.0.0
38
43
  type: :development
39
44
  prerelease: false
40
45
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
46
  requirements:
43
- - - ~>
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '3.0'
50
+ - - ">="
44
51
  - !ruby/object:Gem::Version
45
52
  version: 3.0.0
46
53
  - !ruby/object:Gem::Dependency
47
54
  name: rainbow
48
55
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
56
  requirements:
59
- - - ! '>='
57
+ - - "~>"
60
58
  - !ruby/object:Gem::Version
61
- version: '0'
62
- - !ruby/object:Gem::Dependency
63
- name: rainbow
64
- requirement: !ruby/object:Gem::Requirement
65
- none: false
66
- requirements:
67
- - - ! '>='
59
+ version: 1.1.4
60
+ - - ">="
68
61
  - !ruby/object:Gem::Version
69
- version: '0'
62
+ version: 1.1.4
70
63
  type: :development
71
64
  prerelease: false
72
65
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
66
  requirements:
75
- - - ! '>='
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 1.1.4
70
+ - - ">="
76
71
  - !ruby/object:Gem::Version
77
- version: '0'
72
+ version: 1.1.4
78
73
  - !ruby/object:Gem::Dependency
79
74
  name: handy-css-rails
80
75
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
76
  requirements:
83
- - - '='
77
+ - - "~>"
84
78
  - !ruby/object:Gem::Version
85
- version: 0.0.4
79
+ version: 0.0.5
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 0.0.5
86
83
  type: :development
87
84
  prerelease: false
88
85
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
86
  requirements:
91
- - - '='
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.0.5
90
+ - - ">="
92
91
  - !ruby/object:Gem::Version
93
- version: 0.0.4
92
+ version: 0.0.5
94
93
  description: humdrum-rails is a collection of useful generators which are quite handy
95
94
  for starting up a project in ruby on railgem.
96
95
  email: krishnaprasadvarma@gmail.com
@@ -98,7 +97,7 @@ executables: []
98
97
  extensions: []
99
98
  extra_rdoc_files: []
100
99
  files:
101
- - .gitignore
100
+ - ".gitignore"
102
101
  - Features.md
103
102
  - Gemfile
104
103
  - LICENSE.txt
@@ -156,6 +155,7 @@ files:
156
155
  - lib/rails/generators/humdrum/layout/templates/controllers/welcome_controller.rb
157
156
  - lib/rails/generators/humdrum/layout/templates/helpers/display_helper.rb
158
157
  - lib/rails/generators/humdrum/layout/templates/helpers/flash_helper.rb
158
+ - lib/rails/generators/humdrum/layout/templates/helpers/image_helper.rb
159
159
  - lib/rails/generators/humdrum/layout/templates/helpers/meta_tags_helper.rb
160
160
  - lib/rails/generators/humdrum/layout/templates/helpers/navigation_helper.rb
161
161
  - lib/rails/generators/humdrum/layout/templates/helpers/params_parser_helper.rb
@@ -254,6 +254,7 @@ files:
254
254
  - lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/new.js.erb
255
255
  - lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/show.js.erb
256
256
  - lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/update.js.erb
257
+ - lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_drop_down.html.erb
257
258
  - lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_edit.html.erb
258
259
  - lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_field.html.erb
259
260
  - lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_filters.html.erb
@@ -306,27 +307,27 @@ files:
306
307
  homepage: http://github.com/humdrum
307
308
  licenses:
308
309
  - MIT
310
+ metadata: {}
309
311
  post_install_message:
310
312
  rdoc_options: []
311
313
  require_paths:
312
314
  - lib
313
315
  required_ruby_version: !ruby/object:Gem::Requirement
314
- none: false
315
316
  requirements:
316
- - - ! '>='
317
+ - - ">="
317
318
  - !ruby/object:Gem::Version
318
319
  version: '0'
319
320
  required_rubygems_version: !ruby/object:Gem::Requirement
320
- none: false
321
321
  requirements:
322
- - - ! '>='
322
+ - - ">="
323
323
  - !ruby/object:Gem::Version
324
324
  version: '0'
325
325
  requirements: []
326
326
  rubyforge_project: humdrum
327
- rubygems_version: 1.8.23
327
+ rubygems_version: 2.2.2
328
328
  signing_key:
329
- specification_version: 3
330
- summary: humdrum-rails creates layouts using bootstrap, HTML5boilerplate, modernizer
331
- etc to kick start a project.
329
+ specification_version: 4
330
+ summary: humdrum-rails creates layouts using bootstrap, HTML5boilerplate etc to kick
331
+ start a project.
332
332
  test_files: []
333
+ has_rdoc: