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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +212 -1
  3. data/humdrum-rails.gemspec +1 -1
  4. data/lib/humdrum/version.rb +1 -1
  5. data/lib/rails/generators/humdrum/api/templates/models/resource.rb +8 -8
  6. data/lib/rails/generators/humdrum/layout/layout_generator.rb +37 -37
  7. data/lib/rails/generators/humdrum/layout/templates/controllers/application_controller.rb +7 -3
  8. data/lib/rails/generators/humdrum/layout/templates/helpers/display_helper.rb +4 -12
  9. data/lib/rails/generators/humdrum/layout/templates/helpers/params_parser_helper.rb +1 -16
  10. data/lib/rails/generators/humdrum/layout/templates/stylesheets/application.css +6 -5
  11. data/lib/rails/generators/humdrum/layout/templates/stylesheets/bootstrap3/overrides-bootstrap.css +9 -6
  12. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap2/layouts/application.html.erb +14 -14
  13. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap2/layouts/common/_flash_message.html.erb +4 -4
  14. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap2/layouts/layout_name.html.erb +15 -15
  15. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/application/_header.html.erb +18 -33
  16. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/application.html.erb +15 -15
  17. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/common/_flash_message.html.erb +4 -4
  18. data/lib/rails/generators/humdrum/layout/templates/views/bootstrap3/layouts/layout_name.html.erb +15 -15
  19. data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/application.html.erb +13 -13
  20. data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/common/_flash_message.html.erb +4 -4
  21. data/lib/rails/generators/humdrum/layout/templates/views/gumby/layouts/layout_name.html.erb +13 -13
  22. data/lib/rails/generators/humdrum/resource/templates/controllers/resource_controller.rb +53 -49
  23. data/lib/rails/generators/humdrum/resource/templates/models/resource.rb +9 -11
  24. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_edit.html.erb +2 -2
  25. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_field.html.erb +7 -7
  26. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_filters.html.erb +2 -2
  27. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_form.html.erb +33 -33
  28. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_index.html.erb +1 -1
  29. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_item.html.erb +9 -9
  30. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_nav_filters.html.erb +3 -3
  31. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_new.html.erb +2 -2
  32. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_show.html.erb +13 -13
  33. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/_summary.html.erb +1 -1
  34. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/index.html.erb +6 -6
  35. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap2/resource/index.js.erb +3 -3
  36. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_drop_down.html.erb +1 -1
  37. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_edit.html.erb +2 -2
  38. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_field.html.erb +12 -12
  39. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_filters.html.erb +5 -5
  40. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_form.html.erb +21 -21
  41. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_index.html.erb +1 -1
  42. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_item.html.erb +15 -15
  43. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_nav_filters.html.erb +3 -3
  44. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_new.html.erb +2 -2
  45. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_show.html.erb +20 -20
  46. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/_summary.html.erb +1 -1
  47. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/destroy.js.erb +4 -4
  48. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/index.html.erb +7 -7
  49. data/lib/rails/generators/humdrum/resource/templates/views/bootstrap3/resource/index.js.erb +3 -3
  50. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_edit.html.erb +2 -2
  51. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_field.html.erb +7 -7
  52. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_filters.html.erb +1 -1
  53. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_form.html copy.erb +13 -13
  54. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_form.html.erb +18 -18
  55. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_index.html.erb +1 -1
  56. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_item.html.erb +9 -9
  57. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_nav_filters.html.erb +3 -3
  58. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_new.html.erb +2 -2
  59. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_show.html.erb +19 -19
  60. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/_summary.html.erb +1 -1
  61. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/index.html.erb +6 -6
  62. data/lib/rails/generators/humdrum/resource/templates/views/gumby/resource/index.js.erb +3 -3
  63. data/lib/rails/generators/humdrum/setup/setup_generator.rb +21 -26
  64. data/lib/rails/generators/humdrum/setup/templates/config/database.example.sql +17 -40
  65. data/lib/rails/generators/humdrum/setup/templates/config/database.sql +16 -38
  66. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 764beace85244b2583970dbea418f50cf1f11d95
4
- data.tar.gz: a6e93f7058738cb5668714a52c739a213560c413
3
+ metadata.gz: bbfd7807c2c0c77df353f4b5067cdf0bfe8eb003
4
+ data.tar.gz: de29fb34479544fc0b1117f2afafc154f0a7ef66
5
5
  SHA512:
6
- metadata.gz: d7efb9457f659673b9357061d629f13bd67f9afaf4be318440c97a0cabb696f1127062b9a19cccdbecb828ade5d21e09a34b814b21712faf9a2120b222f62e2f
7
- data.tar.gz: 80870b78984aefbd2fdd8b8dbb7ec1d25600584289f0198468cc0d9c74eb8e7e19f175de74184c84210550a89d9e007b902447703a7c5ad40bb59318e84fdc9c
6
+ metadata.gz: 398f127b42b5659fa6b6c16fdc419ed4333626c7a7450e717cde6b64e9717387cf1f1ff87e486f4f3a71e214ef7b882fb96ce5407b329f31c13320969d26329b
7
+ data.tar.gz: 2e1786442698257e8ba834b85b87602fe81be9793723ac3ff645ea7f6fca2190c8c2089e68db2901441aa798313b84e4458108896f2a99b1a4c51506c93d27fb
data/README.md CHANGED
@@ -18,7 +18,218 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ ### STEP 1: Create the rails application
22
+
23
+ $ rails new my_rails_app -m https://gist.githubusercontent.com/kpvarma/8fe9ed04092bb7868917/raw --skip-test-unit --skip-bundle
24
+
25
+ The -m option will generate the application, download the template from the url mentioned and apply it to the generated output.
26
+ Open the Gemfile once when the application is created and you will see the Gemfile having all the gems from the template
27
+ Feel free to visit the URL https://gist.githubusercontent.com/kpvarma/8fe9ed04092bb7868917 to know how the template looks like.
28
+ Checkout http://guides.rubyonrails.org/generators.html#generator-methods for knowing more about Rails Generators.
29
+
30
+ ### STEP 2: Setup the project
31
+
32
+ We now have a bare rails application.
33
+
34
+ If you dont have bundler installed, first install it
35
+ $ gem install bundler
36
+
37
+ Lets bundle install which will download all the required gems
38
+ $ bundle install
39
+
40
+
41
+ ### STEP 3: Basic Humdrum Setup
42
+
43
+ We will now see how humdrum can help us in setting up a project quickly.
44
+
45
+ $ rails g humdrum:setup --config-database --dbase_name=my_rails_app --db_username=kpvarma --password=password1234 --rbenv_gemsets=my_rails_app
46
+
47
+ Type **Y** for all the questions and you will see something like this:
48
+
49
+ remove public/index.html
50
+ create config/initializers/config_center.rb
51
+ create config/locales/humdrum.en.yml
52
+ create lib/core_ext/string.rb
53
+ conflict .gitignore
54
+ Overwrite /Users/kvarma/Projects/VarmaLabs/OpenSource/my_rails_app/.gitignore? (enter "h" for help) [Ynaqdh] Y
55
+ force .gitignore
56
+ create .ruby-version
57
+ create .rbenv-gemsets
58
+ create config/database.example.yml
59
+ conflict config/database.yml
60
+ Overwrite /Users/kvarma/Projects/VarmaLabs/OpenSource/my_rails_app/config/database.yml? (enter "h" for help) [Ynaqdh] Y
61
+ force config/database.yml
62
+
63
+ You will find more about these files and its usages in Wiki Section.
64
+ As of now you just need to understand that humdrum:setup does the following:
65
+
66
+ - removes the public/index.html for old rails application (This is not applicable for rails 4+)
67
+ - creates a config_center.rb which is quite usefull to put all application constants. Open the file and check it out to understand what all things are there.
68
+ - humdrum.en.yml is required by the controllers generated by humdrum for dealing with alerts and messages
69
+ - string.rb has a useful mesthod is added to active record for randomly accessing elements from a table
70
+ - .gitignore has a list of all the usefull file paths to be ignored by git
71
+ - .ruby-version and -rbenv-gemsets helps us to manage ruby versions while dealing with a large number of projects
72
+ - humdrum will generate database.yml with the options passed - checkout database.yml to understand better.
73
+ - database.example.yml are required for deployment using capistrano. Ignore this if you are not dealing with deployment with capistrano.
74
+
75
+ ### STEP 4: Create the database
76
+
77
+ $ bundle exec rake db:create
78
+ $ bundle exec rake db:migrate
79
+
80
+ This should now create the required database
81
+
82
+ ### STEP 4: Create a layout using humdrum
83
+
84
+ $ bundle exec rails g humdrum:layout "user" --application-name="My Rails App" --fluid --framework=bootstrap3 -f
85
+
86
+ This will create layouts compatible with bootstrap3 for quick start. This will also create a welcome page (landing page) which is linked as root url in routes.rb. You should see the following:
87
+
88
+ force app/assets/stylesheets/application.css
89
+ create app/assets/stylesheets/bootstrap.css
90
+ create app/assets/stylesheets/overrides-bootstrap.css
91
+ force app/assets/javascripts/application.js
92
+ create app/assets/javascripts/validations/main.js
93
+ create app/assets/javascripts/bootstrap.min.js
94
+ create app/assets/javascripts/utilities.js
95
+ create app/assets/images/favicon.ico
96
+ create app/helpers/image_helper.rb
97
+ create app/helpers/title_helper.rb
98
+ create app/helpers/navigation_helper.rb
99
+ create app/helpers/meta_tags_helper.rb
100
+ create app/helpers/display_helper.rb
101
+ create app/helpers/params_parser_helper.rb
102
+ create app/helpers/flash_helper.rb
103
+ force app/views/layouts/application.html.erb
104
+ create app/views/layouts/application/_header.html.erb
105
+ create app/views/layouts/application/_footer.html.erb
106
+ create app/views/layouts/application/_navbar.html.erb
107
+ create app/views/layouts/common/_flash_message.html.erb
108
+ create app/views/layouts/common/_meta_tags.html.erb
109
+ create app/views/layouts/common/_overlays.html.erb
110
+ create app/views/layouts/user.html.erb
111
+ create app/views/layouts/user/_header.html.erb
112
+ create app/views/layouts/user/_footer.html.erb
113
+ create app/views/layouts/user/_navbar.html.erb
114
+ force app/controllers/application_controller.rb
115
+ create app/controllers/welcome_controller.rb
116
+ create app/controllers/user_controller.rb
117
+ create app/views/welcome/index.html.erb
118
+ create app/views/kaminari/_first_page.html.erb
119
+ create app/views/kaminari/_gap.html.erb
120
+ create app/views/kaminari/_last_page.html.erb
121
+ create app/views/kaminari/_next_page.html.erb
122
+ create app/views/kaminari/_page.html.erb
123
+ create app/views/kaminari/_paginator.html.erb
124
+ create app/views/kaminari/_prev_page.html.erb
125
+ route root :to => 'welcome#index'
126
+
127
+ Once again check your database.yml and ensure that the username and password is correct.
128
+ Otherwise you are likely to see an error like this:
129
+ "FATAL: role "xxxxxx" does not exist Run `$ bin/rake db:create db:migrate` to create your database"
130
+
131
+
132
+ Once everything checked, start the rails server:
133
+
134
+ $ rails s
135
+
136
+ Take a browser and hit http://localhost:3000 and chekc out.
137
+
138
+ ### STEP 5: Create a resource using humdrum
139
+
140
+ $ rails g humdrum:resource users/documents name:string --fluid --framework=bootstrap3
141
+
142
+
143
+ This will create layouts compatible with bootstrap3 for quick start. This will also create a welcome page (landing page) which is linked as root url in routes.rb.
144
+ Once this is done, start the rails server, take a browser and hit http://localhost:3000
145
+
146
+ $ rails s
147
+ <browser> http://localhost:3000
148
+
149
+
150
+ STEP LAST: Learn more about humdrum
151
+
152
+ Now try
153
+
154
+ rails g humdrum:setup --help
155
+ rails g humdrum:layout --help
156
+
157
+ rails g humdrum:resource --help
158
+
159
+ rails g humdrum:api --help
160
+
161
+ You will see the usage
162
+
163
+ Possible Errors:
164
+
165
+ When you run
166
+
167
+
168
+ rails g humdrum:setup --help
169
+
170
+ if you see 'Could not find generator humdrum:setup.' error you should go to Gemfile and ensure that you add humdrum to it
171
+
172
+ gem "humdrum", "0.1.1"
173
+
174
+ Humdrum also requires the following gems . so ensure that you have the latest ones.
175
+
176
+ gem 'jquery-rails'
177
+ gem 'jquery-validation-rails'
178
+ gem "kaminari"
179
+ gem "handy-css-rails", "0.0.4"
180
+
181
+ You might want to add the following ones if you are using bootstrap framework
182
+
183
+ gem "bootstrap-kaminari-views"
184
+ gem "bootstrap-datepicker-rails"
185
+
186
+
187
+ Setup
188
+
189
+ rails g humdrum:setup --dbase="postgresql" --dbase_name="htb" --db_username="krishnan" db_password="password" --ruby_version="ruby-1.9.3-p429" --ruby_gemset="htb"
190
+
191
+ This will create a ruby-version and ruby-gemset file. Also copies database.yml and database.example.yml (In a better format)
192
+
193
+ No go back to parent folder and cd project_directory once again
194
+ $ cd ..
195
+ $ cd htb_app
196
+
197
+ check rvm current
198
+ you will see
199
+ ruby-1.9.3-p429@htb
200
+
201
+ now do bundle install again.
202
+
203
+ Different usages
204
+
205
+ rails g humdrum:setup
206
+ rails g humdrum:setup -p
207
+ rails g humdrum:setup --skip-gitignore -p
208
+ rails g humdrum:setup --skip-gitignore -p
209
+ rails g humdrum:setup --skip-gitignore --skip-ruby-gemset-p
210
+ rails g humdrum:setup --skip-gitignore --skip-ruby-gemset -p
211
+ rails g humdrum:setup --skip-gitignore --skip-gemset -p
212
+ rails g humdrum:setup --skip-gitignore --skip-gemset --skip-version -p
213
+ rails g humdrum:setup --skip-gitignore --skip-gemset --skip-version -p
214
+ rails g humdrum:setup --skip-gitignore --skip-gemset --skip-version --config-database -p
215
+ rails g humdrum:setup --skip-gitignore --skip-gemset --skip-version --config-database -p
216
+ rails g humdrum:setup --skip-gitignore --skip-gemset --skip-version -p
217
+ rails g humdrum:setup --skip-gitignore --skip-gemset --skip-version --config-database -p
218
+ rails g humdrum:setup --config-database --dbase="postgresql" --dbase_name="htb" --db_username="krishnan" db_password="password" --ruby_version="ruby-1.9.3-p429" --ruby_gemset="htb" -p
219
+
220
+ Layout
221
+
222
+ Create a basic layout including admin modules and user modules
223
+ rails g humdrum:layout "HTB App" --create_admin_layout --create_user_layout -f
224
+
225
+ skip welcome page
226
+ rails g humdrum:layout "HTB App" --create_admin_layout --create_user_layout --skip_welcome_page -p
227
+
228
+ Create a plain public layout to start with, including a landing page (welcome)
229
+ rails g humdrum:layout "HTB App"
230
+
231
+ Resource
232
+
22
233
 
23
234
  ## Contributing
24
235
 
@@ -25,6 +25,6 @@ Gem::Specification.new do |gem|
25
25
  gem.add_runtime_dependency 'colorize', '~> 0.7', '>= 0.7.3'
26
26
  gem.add_development_dependency 'rails', '~> 3.0', '>= 3.0.0'
27
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'
28
+ gem.add_development_dependency 'handy-css-rails', '~> 0.0.7', '>= 0.0.7'
29
29
 
30
30
  end
@@ -1,4 +1,4 @@
1
1
  module Humdrum
2
2
  # http://semver.org/
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
@@ -1,7 +1,7 @@
1
1
  class <%= model_class %> < ActiveRecord::Base
2
-
3
- attr_accessible <%= fields.keys.map{|x| ":" + x.downcase }.join(", ") %>
4
-
2
+
3
+ #attr_accessible <%= fields.keys.map{|x| ":" + x.downcase }.join(", ") %>
4
+
5
5
  # Validations
6
6
  <%- fields.each do |name, type| -%>
7
7
  <%- if type == "string" %>
@@ -11,22 +11,22 @@ class <%= model_class %> < ActiveRecord::Base
11
11
  <%- elsif type == "integer" %>
12
12
  #validates :<%= name %>, :presence=>true, :numericality => true, :if => proc{|x| x.condition? }
13
13
  <%- elsif type == "decimal" || type == "float" %>
14
- #validates :<%= name %>, :format => { :with => /^\d+??(?:\.\d{0,2})?$/ },
14
+ #validates :<%= name %>, :format => { :with => /^\d+??(?:\.\d{0,2})?$/ },
15
15
  :numericality =>{:greater_than => 0}
16
16
  <%- elsif type != "boolean" %>
17
17
  #validates :<%= name %>, :presence=>true
18
18
  <%- end -%>
19
19
  <%- end -%>
20
-
20
+
21
21
  # Validation Examples
22
22
  #LANDLINE_LIST = ["1234567890", "0987654321"]
23
- #validates :first_name,
23
+ #validates :first_name,
24
24
  # :presence=>true,
25
25
  # :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"},
26
+ # :maximum => ConfigCenter::GeneralValidations::FIRST_NAME_MAX_LEN, :message => "should be less than x and greater than y"},
27
27
  # :uniqueness => {:scope => [:user_id, :status], :case_sensitive => false},
28
28
  # :format => {:with => ConfigCenter::GeneralValidations::FIRST_NAME_FORMAT_REG_EXP, :message => "Invalid format"},
29
29
  # :inclusion => { :in => PHONE_LIST, :message => "not included in the list" },
30
30
  # :unless => proc{|user| user.password.blank? }
31
-
31
+
32
32
  end
@@ -1,19 +1,19 @@
1
1
  module Humdrum
2
2
  module Generators
3
3
  class LayoutGenerator < Rails::Generators::Base
4
-
4
+
5
5
  source_root File.expand_path('../templates', __FILE__)
6
-
6
+
7
7
  desc "Generates a layout file with the given name (default is 'application') and the required partials " <<
8
8
  "Pass --application_name=MyNewApp to set a name / brand for the application." <<
9
9
  "Pass --framework=bootstrap3 to copy bootstrap3 assets and generate a layout which is compatible to it."
10
-
10
+
11
11
  argument :layout_name, :type=>:string, :default => "application", :desc => "This creates/replaces application.html.erb by default"
12
-
12
+
13
13
  class_option :application_name, :type => :string, :default => "New App", :desc => "The name of the application. This is used as the brand name in header."
14
14
  class_option :fixed, :type => :boolean, :default => false, :desc => "Create fixed layouts. Default is fluid (Gumby doesn't support fluid framework. Hence applicable only for bootstrap for the timebeing.)"
15
15
  class_option :framework, :type => :string, :default => 'bootstrap3', :desc => "Support Twitter Bootstrap (twitter.github.io/bootstrap/) and Gumpy (http://gumbyframework.com/). Default is bootstrap. Pass gumby for Gumby Framework"
16
-
16
+
17
17
  class_option :skip_stylesheet, :type => :boolean, :default => false, :desc => "Generate the stylesheets"
18
18
  class_option :skip_javascript, :type => :boolean, :default => false, :desc => "Generate the javascripts"
19
19
  class_option :skip_graphics, :type => :boolean, :default => false, :desc => "Generate the graphics (images required for the css and UI frameworks)"
@@ -23,58 +23,58 @@ module Humdrum
23
23
 
24
24
  ## Parse from config file
25
25
  #class_option :config_file, :type => :string, :desc => "Parse options from the config file."
26
-
26
+
27
27
  #@@config = nil
28
-
28
+
29
29
  #def config
30
30
  # args = options.dup
31
31
  # args.config_file ||= '.csvconverter.yaml'
32
32
  #
33
33
  # config = YAML::load File.open(args[:file], 'r')
34
34
  #end
35
-
35
+
36
36
  def application_name
37
37
  options.application_name
38
38
  end
39
-
39
+
40
40
  def framework
41
41
  options.framework
42
42
  end
43
-
43
+
44
44
  def generate_stylesheets
45
45
  unless options.skip_stylesheet?
46
-
46
+
47
47
  template "stylesheets/application.css", "app/assets/stylesheets/application.css"
48
-
48
+
49
49
  case framework
50
50
  when "bootstrap3"
51
-
51
+
52
52
  # Copy bootstrap css file
53
53
  copy_file "stylesheets/bootstrap3/bootstrap.css", "app/assets/stylesheets/bootstrap.css"
54
-
54
+
55
55
  # Its named overrides-bootstrap so that it loads after bootstrap.css
56
56
  copy_file "stylesheets/bootstrap3/overrides-bootstrap.css", "app/assets/stylesheets/overrides-bootstrap.css"
57
57
  when "bootstrap2"
58
-
58
+
59
59
  # Copy bootstrap css file
60
60
  copy_file "stylesheets/bootstrap2/bootstrap.css", "app/assets/stylesheets/bootstrap.css"
61
61
  copy_file "stylesheets/bootstrap2/bootstrap-responsive.css", "app/assets/stylesheets/bootstrap-responsive.css"
62
-
62
+
63
63
  # Its named overrides-bootstrap so that it loads after bootstrap.css
64
64
  copy_file "stylesheets/bootstrap2/overrides-bootstrap.css", "app/assets/stylesheets/overrides-bootstrap.css"
65
65
  when "gumby"
66
-
66
+
67
67
  # Copy gumby css file
68
68
  copy_file "stylesheets/gumby/gumby.css", "app/assets/stylesheets/gumby.css"
69
69
  copy_file "stylesheets/gumby/gumby-pagination.css", "app/assets/stylesheets/gumby-pagination.css"
70
-
70
+
71
71
  # Its named overrides-gumby so that it loads after gumby.css
72
72
  copy_file "stylesheets/gumby/overrides-gumby.css", "app/assets/stylesheets/overrides-gumby.css"
73
73
  end
74
-
74
+
75
75
  end
76
76
  end
77
-
77
+
78
78
  def generate_javascripts
79
79
  unless options.skip_javascript?
80
80
  template "javascripts/application.js", "app/assets/javascripts/application.js"
@@ -92,7 +92,7 @@ module Humdrum
92
92
  end
93
93
  end
94
94
  end
95
-
95
+
96
96
  # TODO - This section has to be optimized. All the assets should be organized under the framework folders.
97
97
  # We should also use fontawesome irrespective of what the framework is
98
98
  def generate_graphics
@@ -110,7 +110,7 @@ module Humdrum
110
110
  end
111
111
  end
112
112
  end
113
-
113
+
114
114
  def generate_helpers
115
115
  template "helpers/image_helper.rb", "app/helpers/image_helper.rb"
116
116
  template "helpers/title_helper.rb", "app/helpers/title_helper.rb"
@@ -120,34 +120,34 @@ module Humdrum
120
120
  template "helpers/params_parser_helper.rb", "app/helpers/params_parser_helper.rb"
121
121
  template "helpers/flash_helper.rb", "app/helpers/flash_helper.rb"
122
122
  end
123
-
123
+
124
124
  def generate_layout
125
-
126
- template "views/#{framework}/layouts/application.html.erb", "app/views/layouts/application.html.erb"
125
+
126
+ template "views/#{framework}/layouts/application.html.erb", "app/views/layouts/application.html.erb"
127
127
  template "views/#{framework}/layouts/application/_header.html.erb", "app/views/layouts/application/_header.html.erb"
128
128
  template "views/#{framework}/layouts/application/_footer.html.erb", "app/views/layouts/application/_footer.html.erb"
129
129
  template "views/#{framework}/layouts/application/_navbar.html.erb", "app/views/layouts/application/_navbar.html.erb"
130
-
130
+
131
131
  template "views/#{framework}/layouts/common/_flash_message.html.erb", "app/views/layouts/common/_flash_message.html.erb"
132
132
  template "views/#{framework}/layouts/common/_meta_tags.html.erb", "app/views/layouts/common/_meta_tags.html.erb"
133
133
  template "views/#{framework}/layouts/common/_overlays.html.erb", "app/views/layouts/common/_overlays.html.erb"
134
-
135
- template "views/#{framework}/layouts/layout_name.html.erb", "app/views/layouts/#{layout_name}.html.erb"
134
+
135
+ template "views/#{framework}/layouts/layout_name.html.erb", "app/views/layouts/#{layout_name}.html.erb"
136
136
  template "views/#{framework}/layouts/layout_name/_header.html.erb", "app/views/layouts/#{layout_name}/_header.html.erb"
137
137
  template "views/#{framework}/layouts/layout_name/_footer.html.erb", "app/views/layouts/#{layout_name}/_footer.html.erb"
138
138
  template "views/#{framework}/layouts/layout_name/_navbar.html.erb", "app/views/layouts/#{layout_name}/_navbar.html.erb"
139
-
139
+
140
140
  end
141
-
141
+
142
142
  def generate_controllers
143
143
  template "controllers/application_controller.rb", "app/controllers/application_controller.rb"
144
144
  template "controllers/welcome_controller.rb", "app/controllers/welcome_controller.rb" unless options.skip_welcome_page?
145
145
  template "controllers/layout_name_controller.rb", "app/controllers/#{layout_name}_controller.rb"
146
146
  end
147
-
147
+
148
148
  def generate_views
149
149
  template "views/#{framework}/welcome/index.html.erb", "app/views/welcome/index.html.erb" unless options.skip_welcome_page?
150
-
150
+
151
151
  # Copy kaminari templates
152
152
  unless options.skip_kaminari?
153
153
  template "views/#{framework}/kaminari/_first_page.html.erb", "app/views/kaminari/_first_page.html.erb"
@@ -159,13 +159,13 @@ module Humdrum
159
159
  template "views/#{framework}/kaminari/_prev_page.html.erb", "app/views/kaminari/_prev_page.html.erb"
160
160
  end
161
161
  end
162
-
162
+
163
163
  def generate_routes
164
164
  route("root :to => 'welcome#index'") unless options.skip_welcome_page
165
165
  end
166
-
166
+
167
167
  private
168
-
168
+
169
169
  def container_class
170
170
  case framework
171
171
  when "bootstrap3", "gumby"
@@ -176,7 +176,7 @@ module Humdrum
176
176
  options.fixed? ? "container" : "container-fluid"
177
177
  end
178
178
  end
179
-
179
+
180
180
  def row_class
181
181
  case framework
182
182
  when "bootstrap3", "gumby"
@@ -187,7 +187,7 @@ module Humdrum
187
187
  options.fixed? ? "row" : "row-fluid"
188
188
  end
189
189
  end
190
-
190
+
191
191
  end
192
192
  end
193
193
  end
@@ -1,8 +1,12 @@
1
1
  class ApplicationController < ActionController::Base
2
2
  protect_from_forgery
3
-
4
- include ParamsParserHelper
3
+
4
+ include DisplayHelper
5
5
  include FlashHelper
6
+ include ImageHelper
7
+ include MetaTagsHelper
6
8
  include NavigationHelper
7
-
9
+ include ParamsParserHelper
10
+ include TitleHelper
11
+
8
12
  end
@@ -1,5 +1,5 @@
1
1
  module DisplayHelper
2
-
2
+
3
3
  def scrap_word(text, char_count_limit, more_text = nil, more_link = nil,style='')
4
4
  # remove HTML tags
5
5
  text = text.to_s.gsub(/<\/?[^>]*>/, " ")
@@ -26,17 +26,9 @@ module DisplayHelper
26
26
  end
27
27
  return teaser
28
28
  end
29
-
30
- def display_time(disp_time, class_name = nil)
29
+
30
+ def display_time(disp_time, class_name="")
31
31
  return distance_of_time_in_words_to_now(disp_time) + " ago"
32
- # return_str = ""
33
- # if ((Time.now - disp_time) < (6*24*60*60))
34
- # return_str = distance_of_time_in_words_to_now(disp_time) + " ago"
35
- # else
36
- # return_str = "#{disp_time.strftime('%m/%d/%y')}"
37
- # end
38
- #
39
- # return content_tag("span", return_str, :class => (class_name.nil? ? "text-color-grey" : class_name))
40
32
  end
41
-
33
+
42
34
  end
@@ -1,5 +1,5 @@
1
1
  module ParamsParserHelper
2
-
2
+
3
3
  def parse_pagination_params
4
4
  @current_page = params[:page] || "1"
5
5
  @per_page = params[:per_page] || ConfigCenter::Defaults::ITEMS_PER_LIST.to_s
@@ -9,23 +9,8 @@ module ParamsParserHelper
9
9
  end
10
10
 
11
11
  @offset = (@current_page.to_i - 1) * (@per_page.to_i)
12
-
13
12
  end
14
13
 
15
- def parse_filter_dates(instance_name, start_date_name="start_date", end_date_name="end_date")
16
- ## Parsing the date info if any
17
- unless params[instance_name][start_date_name].blank?
18
- d = params[instance_name][start_date_name] ? (Time.parse(params[instance_name][start_date_name])) : (Date.today - 1.day)
19
- @start_date = params[instance_name][:start_date] || (Date.today - 1.day)
20
- @start_time = Time.utc(d.year,d.month,d.day,00,00,00)
21
- end
22
- unless params[instance_name][end_date_name].blank?
23
- d = params[instance_name][end_date_name] ? Time.parse(params[instance_name][end_date_name]) : Date.today
24
- @end_date = params[instance_name][end_date_name] || Date.today
25
- @end_time = Time.utc(d.year,d.month,d.day,23,59,59)
26
- end
27
- end
28
-
29
14
  end
30
15
 
31
16
 
@@ -9,12 +9,13 @@
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
10
  *
11
11
  *= require_self
12
+ * handycss is a bunch of handy CSS which can be used directly in any project, developed with SCSS
13
+ * Chekcout https://github.com/kpvarma/handyCSS and https://github.com/kpvarma/handy-css-rails
14
+ *= require handycss.css
15
+ * require handycss.box.css
16
+ * require handycss.backdrops.css
12
17
 
13
- *= require handyCSS.css
14
- * require handyCSS.box.css
15
- * require handyCSS.backdrops.css
16
-
17
- <% case framework
18
+ <% case framework
18
19
  when "bootstrap3" -%>
19
20
  * require bootstrap-rails (Alternatively you can use the bootstrap3-rails gem)
20
21
  *= require bootstrap
@@ -1,12 +1,15 @@
1
- body { padding: 30px; }
1
+ body { padding: 5px; }
2
2
 
3
3
  .navbar { margin-bottom: 0px; }
4
4
 
5
5
  .alert { padding:10px; }
6
6
 
7
7
  .container {
8
- padding-right: 5px;
9
- padding-left: 5px;
10
- margin-right: auto;
11
- margin-left: auto;
12
- }
8
+ padding-right: 5px;
9
+ padding-left: 5px;
10
+ margin-right: auto;
11
+ margin-left: auto;
12
+ }
13
+
14
+ .dropdown-menu.align-right {left: -65%;}
15
+ .box .row {margin: 0px !important}
@@ -4,29 +4,29 @@
4
4
  <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
5
5
  <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
6
6
  <head>
7
-
7
+
8
8
  <title><%%= title -%></title>
9
-
9
+
10
10
  <%%= render :partial=>"/layouts/common/meta_tags" -%>
11
11
 
12
12
  <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
13
13
  <link rel="icon" href="/assets/favicon.ico" type="image/png">
14
-
14
+
15
15
  <%%= stylesheet_link_tag "application", :media => "all" -%>
16
-
16
+
17
17
  <%%= csrf_meta_tags -%>
18
18
 
19
19
  </head>
20
20
 
21
21
  <body>
22
-
22
+
23
23
  <!--[if lt IE 7]>
24
- <p class="chromeframe">You are using an <strong>outdated</strong> browser.
25
- Please <a href="http://browsehappy.com/">upgrade your browser</a> or
26
- <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a>
24
+ <p class="chromeframe">You are using an <strong>outdated</strong> browser.
25
+ Please <a href="http://browsehappy.com/">upgrade your browser</a> or
26
+ <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a>
27
27
  to improve your experience.</p>
28
28
  <![endif]-->
29
-
29
+
30
30
  <div class="header-block clearfix">
31
31
  <div id="div_page_header">
32
32
  <%%= render :partial=>"/layouts/application/header" -%>
@@ -35,19 +35,19 @@
35
35
  <%%= render :partial=>"/layouts/application/navbar" -%>
36
36
  </div>
37
37
  </div>
38
-
38
+
39
39
  <%%#* Show flash messages if controller has set any. -%>
40
40
  <div id="div_flash_message">
41
41
  <%%= render :partial=>"/layouts/common/flash_message" -%>
42
42
  </div>
43
-
44
- <div class="<%= container_class %> padding-top-10" style="min-height:400px;">
43
+
44
+ <div class="<%= container_class %> pt-10" style="min-height:400px;">
45
45
  <%%= yield %>
46
46
  </div>
47
-
47
+
48
48
  <%%#* Display Footer -%>
49
49
  <%%= render :partial=>"/layouts/application/footer" -%>
50
-
50
+
51
51
  <%%#* Display Hidden Overlays -%>
52
52
  <%%= render :partial=>"/layouts/common/overlays" -%>
53
53