poodle-rb 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/fonts/FontAwesome.otf +0 -0
  6. data/app/assets/fonts/fontawesome-webfont.eot +0 -0
  7. data/app/assets/fonts/fontawesome-webfont.svg +520 -0
  8. data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  9. data/app/assets/fonts/fontawesome-webfont.woff +0 -0
  10. data/app/assets/javascripts/poodle/application.js +21 -0
  11. data/app/assets/javascripts/poodle/bootstrap.js +2323 -0
  12. data/app/assets/javascripts/poodle/common.js +0 -0
  13. data/app/assets/javascripts/poodle/photo_upload.js +104 -0
  14. data/app/assets/javascripts/poodle/utilities.js +50 -0
  15. data/app/assets/javascripts/poodle/validations/sample.js +67 -0
  16. data/app/assets/stylesheets/poodle/application.css +18 -0
  17. data/app/assets/stylesheets/poodle/bootstrap-theme.css +473 -0
  18. data/app/assets/stylesheets/poodle/bootstrap.css +5482 -0
  19. data/app/assets/stylesheets/poodle/font-awesome.css +1672 -0
  20. data/app/assets/stylesheets/poodle/poodle-theme.css +55 -0
  21. data/app/controllers/poodle/application_controller.rb +15 -0
  22. data/app/helpers/poodle/application_helper.rb +4 -0
  23. data/app/helpers/poodle/display_helper.rb +36 -0
  24. data/app/helpers/poodle/flash_helper.rb +14 -0
  25. data/app/helpers/poodle/image_helper.rb +100 -0
  26. data/app/helpers/poodle/meta_tags_helper.rb +4 -0
  27. data/app/helpers/poodle/navigation_helper.rb +20 -0
  28. data/app/helpers/poodle/notification_helper.rb +20 -0
  29. data/app/helpers/poodle/params_parser_helper.rb +32 -0
  30. data/app/helpers/poodle/title_helper.rb +16 -0
  31. data/app/helpers/poodle/url_helper.rb +21 -0
  32. data/app/views/layouts/poodle/application/_footer.html.erb +5 -0
  33. data/app/views/layouts/poodle/application/_header.html.erb +26 -0
  34. data/app/views/layouts/poodle/application/_sidebar.html.erb +45 -0
  35. data/app/views/layouts/poodle/application.html.erb +56 -0
  36. data/app/views/layouts/poodle/common/_field.html.erb +46 -0
  37. data/app/views/layouts/poodle/common/_flash_message.html.erb +23 -0
  38. data/app/views/layouts/poodle/common/_meta_tags.html.erb +42 -0
  39. data/app/views/layouts/poodle/common/_overlays.html.erb +28 -0
  40. data/app/views/layouts/poodle/public.html.erb +48 -0
  41. data/app/views/widgets/_more_details.html.erb +89 -0
  42. data/config/initializers/api_errors.rb +32 -0
  43. data/config/routes.rb +2 -0
  44. data/lib/poodle/configuration.rb +14 -0
  45. data/lib/poodle/engine.rb +5 -0
  46. data/lib/poodle/version.rb +3 -0
  47. data/lib/poodle-rb.rb +20 -0
  48. data/lib/tasks/poodle_tasks.rake +4 -0
  49. data/test/dummy/README.rdoc +28 -0
  50. data/test/dummy/Rakefile +6 -0
  51. data/test/dummy/app/assets/javascripts/application.js +13 -0
  52. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  53. data/test/dummy/app/controllers/application_controller.rb +5 -0
  54. data/test/dummy/app/helpers/application_helper.rb +2 -0
  55. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  56. data/test/dummy/bin/bundle +3 -0
  57. data/test/dummy/bin/rails +4 -0
  58. data/test/dummy/bin/rake +4 -0
  59. data/test/dummy/config/application.rb +23 -0
  60. data/test/dummy/config/boot.rb +5 -0
  61. data/test/dummy/config/database.yml +25 -0
  62. data/test/dummy/config/environment.rb +5 -0
  63. data/test/dummy/config/environments/development.rb +37 -0
  64. data/test/dummy/config/environments/production.rb +78 -0
  65. data/test/dummy/config/environments/test.rb +39 -0
  66. data/test/dummy/config/initializers/assets.rb +8 -0
  67. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  68. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  69. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  70. data/test/dummy/config/initializers/inflections.rb +16 -0
  71. data/test/dummy/config/initializers/mime_types.rb +4 -0
  72. data/test/dummy/config/initializers/session_store.rb +3 -0
  73. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  74. data/test/dummy/config/locales/en.yml +23 -0
  75. data/test/dummy/config/routes.rb +4 -0
  76. data/test/dummy/config/secrets.yml +22 -0
  77. data/test/dummy/config.ru +4 -0
  78. data/test/dummy/public/404.html +67 -0
  79. data/test/dummy/public/422.html +67 -0
  80. data/test/dummy/public/500.html +66 -0
  81. data/test/dummy/public/favicon.ico +0 -0
  82. data/test/integration/navigation_test.rb +10 -0
  83. data/test/poodle_test.rb +7 -0
  84. data/test/test_helper.rb +19 -0
  85. metadata +226 -0
@@ -0,0 +1,55 @@
1
+ /* Styles for footer */
2
+ .footer {margin:100px 0px 0px 0px;color: #4b4b4b;height:50px;text-align:center;}
3
+
4
+ /* Styles for Sidebar and Main Content */
5
+
6
+ .sidebar li {margin:18px 0px;padding-left:25px;list-style: none;}
7
+ .sidebar li.heading {color: #D0D0D0;margin: 25px 0px;padding-left:5px;}
8
+ .sidebar li.active {background-color: #eeeeee;padding: 10px;}
9
+ .sidebar li.active a {color: #cd2177;}
10
+ .sidebar li a {color: #fff; margin:5px 0px;}
11
+ .sidebar li a:hover {color: #f0f0f0;text-decoration: none;}
12
+
13
+ @media (min-width: 500px) {
14
+ .container-fluid.with_sidebar {padding-left:0px;}
15
+ .main-content {float: left;width:70%;margin-left:15px;}
16
+ .sidebar{display:block;float: left;background-color:#15894F;color:#fff;padding:10px;height:200vh;position: relative; width:25%;}
17
+ }
18
+
19
+ @media (max-width: 700px) {
20
+ .sidebar ul {padding:0px; margin:0px;}
21
+ }
22
+
23
+ @media (max-width: 500px) {
24
+ .main-content {float: none;width:100%;margin-left:0px;}
25
+ .sidebar{display:none}
26
+ .btn-text{display: none}
27
+ }
28
+
29
+ .panel-420 {
30
+ top: 50%;
31
+ left: 50%;
32
+ display: block;
33
+ margin-top: -185px;
34
+ margin-left: -205px;
35
+ width: 420px;
36
+ height: auto;
37
+ position: absolute;
38
+ }
39
+
40
+ .panel-bordered {
41
+ -webkit-border-radius: 15px;
42
+ -moz-border-radius: 15px;
43
+ -ms-border-radius: 15px;
44
+ -o-border-radius: 15px;
45
+ border-radius: 15px;
46
+ }
47
+
48
+ .rounded {
49
+ overflow: hidden;
50
+ -webkit-border-radius: 50%;
51
+ -moz-border-radius: 50%;
52
+ border-radius: 50%;
53
+ border: 1px solid #d1d1d1;
54
+ display: inline-block;
55
+ }
@@ -0,0 +1,15 @@
1
+ class Poodle::ApplicationController < ActionController::Base
2
+
3
+ ## This filter method is used to fetch current user
4
+ before_filter :current_user
5
+
6
+ include Poodle::ParamsParserHelper
7
+ include Poodle::FlashHelper
8
+ include Poodle::UrlHelper
9
+ include Poodle::TitleHelper
10
+ include Poodle::ImageHelper
11
+ include Poodle::NavigationHelper
12
+ include Poodle::SessionsHelper
13
+ include Poodle::NotificationHelper
14
+
15
+ end
@@ -0,0 +1,4 @@
1
+ module Poodle
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,36 @@
1
+ module Poodle
2
+ module DisplayHelper
3
+
4
+ def scrap_word(text, char_count_limit, more_text = nil, more_link = nil,style='')
5
+ # remove HTML tags
6
+ text = text.to_s.gsub(/<\/?[^>]*>/, " ")
7
+ # remove additional spaces
8
+ text = text.to_s.gsub(/[ ]+/, " ")
9
+ if text.length < char_count_limit
10
+ return text
11
+ end
12
+ teaser = ""
13
+ words = text.split(/ /)
14
+ words.each do |word|
15
+ if word.length > 0
16
+ if (teaser + word).length > char_count_limit
17
+ if more_text && more_link
18
+ teaser = teaser + " " + link_to(more_text, more_link,:style=>style, :target=>"_blank")
19
+ else
20
+ teaser = teaser.strip + "..."
21
+ end
22
+ break;
23
+ else
24
+ teaser = teaser + word + " "
25
+ end
26
+ end
27
+ end
28
+ return teaser
29
+ end
30
+
31
+ def display_time(disp_time, class_name = nil)
32
+ return distance_of_time_in_words_to_now(disp_time) + " ago"
33
+ end
34
+
35
+ end
36
+ end
@@ -0,0 +1,14 @@
1
+ module Poodle
2
+ module FlashHelper
3
+
4
+ ## This function will set a flash message depending up on the request type (ajax - xml http or direct http)
5
+ ## example : store_flash_message("The message has been sent successfully", :success)
6
+ def store_flash_message(message, type)
7
+ if request.xhr?
8
+ flash.now[type] = message
9
+ else
10
+ flash[type] = message
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,100 @@
1
+ module Poodle
2
+ module ImageHelper
3
+
4
+ DEFAULT_PLACE_HOLDER_HEIGHT = 60
5
+ DEFAULT_PLACE_HOLDER_WIDTH = 100
6
+ DEFAULT_PLACE_HOLDER_TEXT = "<No Image>"
7
+
8
+ # This method only works with carrier wave way of doing.
9
+ # eg: user.profile_picture.image.large.url
10
+ # Usage:
11
+ # image_url(user, "profile_picture.image.large.url")
12
+ # image_url(user, "profile_picture.image.large.url")
13
+ # image_url(user, "profile_picture.image.large.url", {width: 40, height: 10})
14
+ # Where as the hash contains width and height for the place holder incase if the object doesn't has the image object
15
+ def image_url(object, eval_url, place_holder={})
16
+ begin
17
+ url = object.send :eval, eval_url
18
+ raise if url.blank?
19
+ rescue
20
+ url = place_holder[:url] ? place_holder[:url] : "http://placehold.it/#{place_holder[:width]}x#{place_holder[:height]}&text=#{place_holder[:text]}"
21
+ end
22
+ return url
23
+ end
24
+
25
+ # This method will render the image with required width and height.
26
+ # The image url will be set to the placeholder url if the object doesn't respond to the image method
27
+ # Usage:
28
+ # display_image(client, "logo.image.url")
29
+ # display_image(client, "logo.image.url",
30
+ # width: "100%", height:"100%")
31
+ # display_image(client, "logo.image.url",
32
+ # width: "100%", height:"100%",
33
+ # place_holder: {width: 100, height: 50, text: "<No Image>"})
34
+ def display_image(object, eval_url, hsh={})
35
+ hsh[:width] = "100%" unless hsh[:width]
36
+ hsh[:height] = "auto" unless hsh[:height]
37
+
38
+ ph = hsh.has_key?(:place_holder) ? hsh[:place_holder] : {}
39
+ ph[:width] = ph.has_key?(:width) ? ph[:width] : DEFAULT_PLACE_HOLDER_WIDTH
40
+ ph[:height] = ph.has_key?(:height) ? ph[:height] : DEFAULT_PLACE_HOLDER_HEIGHT
41
+ ph[:text] = ph.has_key?(:text) ? ph[:text] : DEFAULT_PLACE_HOLDER_TEXT
42
+ hsh[:place_holder] = ph
43
+
44
+ hsh[:style] = "" unless hsh[:style]
45
+ hsh[:class] = "" unless hsh[:class]
46
+ img_url = image_url(object, eval_url, ph)
47
+ return image_tag img_url, class: hsh[:class], style: "width:#{hsh[:width]};height:#{hsh[:height]};#{hsh[:style]}"
48
+ end
49
+
50
+ def display_user_image(user, hsh)
51
+ hsh[:width] = "100%" unless hsh[:width]
52
+ hsh[:height] = "auto" unless hsh[:height]
53
+
54
+ ph = hsh.has_key?(:place_holder) ? hsh[:place_holder] : {}
55
+ ph[:width] = ph.has_key?(:width) ? ph[:width] : DEFAULT_PLACE_HOLDER_WIDTH
56
+ ph[:height] = ph.has_key?(:height) ? ph[:height] : DEFAULT_PLACE_HOLDER_HEIGHT
57
+ ph[:text] = ph.has_key?(:text) ? ph[:text] : DEFAULT_PLACE_HOLDER_TEXT
58
+ hsh[:place_holder] = ph
59
+
60
+ hsh[:style] = "" unless hsh[:style]
61
+ hsh[:class] = "" unless hsh[:class]
62
+ hsh[:size] = "thumb" unless hsh[:size]
63
+ hsh[:url_domain] = "http://localhost:3000" unless hsh[:url_domain]
64
+
65
+ if user.send("#{hsh[:size]}_url").blank?
66
+ url = "http://placehold.it/#{ph[:width]}x#{ph[:height]}&text=#{ph[:text]}"
67
+ else
68
+ url = hsh[:url_domain] + user.send("#{hsh[:size]}_url")
69
+ end
70
+
71
+ return image_tag url, class: hsh[:class], style: "width:#{hsh[:width]};height:#{hsh[:height]};#{hsh[:style]}"
72
+ end
73
+
74
+ ## Returns new photo url or edit existing photo url based on
75
+ # object is associated with photo or not
76
+ # == Examples
77
+ # >>> upload_image_link(@user, admin_user_path(@user), :profile_picture)
78
+ # => "/admin/images/new" OR
79
+ # => "/admin/images/1/edit"
80
+ def upload_image_link(object, redirect_url, assoc_name=:photo)
81
+
82
+ photo_object = nil
83
+ photo_object = object.send(assoc_name) if object.respond_to?(assoc_name)
84
+ #binding.pry
85
+ if photo_object.present?
86
+ edit_admin_image_path(photo_object,
87
+ :redirect_url => redirect_url,
88
+ :imageable_id => object.id,
89
+ :imageable_type => object.class.to_s,
90
+ :image_type => photo_object.class.name)
91
+ else
92
+ photo_object = object.send("build_#{assoc_name}")
93
+ new_admin_image_path(:redirect_url => redirect_url,
94
+ :imageable_id => object.id,
95
+ :imageable_type => object.class.to_s,
96
+ :image_type => photo_object.class.name)
97
+ end
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,4 @@
1
+ module Poodle
2
+ module MetaTagsHelper
3
+ end
4
+ end
@@ -0,0 +1,20 @@
1
+ module Poodle
2
+ module NavigationHelper
3
+
4
+ def nav_active?(name)
5
+ @nav == name
6
+ end
7
+
8
+ def nav_class(name)
9
+ nav_active?(name) ? "active" : ""
10
+ end
11
+
12
+ def set_nav(name)
13
+ @nav = name
14
+ end
15
+
16
+ def current_nav
17
+ @nav
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ module Poodle
2
+ module NotificationHelper
3
+
4
+ ## This function will set a flash message depending up on the request type (ajax - xml http or direct http)
5
+ ## example : store_flash_message("The message has been sent successfully", :success)
6
+ def store_flash_message(message, type)
7
+ if request.xhr?
8
+ flash.now[type] = message
9
+ else
10
+ flash[type] = message
11
+ end
12
+ end
13
+
14
+ def set_notification_messages(heading, alert, not_type)
15
+ @heading = heading
16
+ @alert = alert
17
+ store_flash_message("#{@heading}: #{@alert}", not_type) if defined?(flash) && flash
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,32 @@
1
+ module Poodle
2
+ module ParamsParserHelper
3
+
4
+ def parse_pagination_params
5
+ @current_page = params[:page] || "1"
6
+ @per_page = params[:per_page] || Poodle.configuration.items_per_list.to_s
7
+
8
+ if @per_page && @per_page.to_i > Poodle.configuration.max_items_per_list
9
+ @per_page = Poodle.configuration.items_per_list.to_s
10
+ end
11
+
12
+ @offset = (@current_page.to_i - 1) * (@per_page.to_i)
13
+
14
+ end
15
+
16
+ def parse_filter_dates(instance_name, start_date_name="start_date", end_date_name="end_date")
17
+ ## Parsing the date info if any
18
+ unless params[instance_name][start_date_name].blank?
19
+ d = params[instance_name][start_date_name] ? (Time.parse(params[instance_name][start_date_name])) : (Date.today - 1.day)
20
+ @start_date = params[instance_name][:start_date] || (Date.today - 1.day)
21
+ @start_time = Time.utc(d.year,d.month,d.day,00,00,00)
22
+ end
23
+ unless params[instance_name][end_date_name].blank?
24
+ d = params[instance_name][end_date_name] ? Time.parse(params[instance_name][end_date_name]) : Date.today
25
+ @end_date = params[instance_name][end_date_name] || Date.today
26
+ @end_time = Time.utc(d.year,d.month,d.day,23,59,59)
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+
@@ -0,0 +1,16 @@
1
+ module Poodle
2
+ module TitleHelper
3
+
4
+ def set_heading(heading)
5
+ @heading = heading
6
+ end
7
+
8
+ def set_title(title)
9
+ @title = title
10
+ end
11
+
12
+ def title
13
+ @title || "Q-App | Poodle Client"
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,21 @@
1
+ module Poodle
2
+ module UrlHelper
3
+
4
+ def add_query_params(url, params)
5
+ parsed_uri = URI(url)
6
+
7
+ if parsed_uri.query
8
+ query_params = URI.decode_www_form(parsed_uri.query)
9
+ else
10
+ query_params = []
11
+ end
12
+
13
+ params.each_pair do |k, v|
14
+ query_params << [k.to_s, v]
15
+ end
16
+
17
+ parsed_uri.query = URI.encode_www_form(query_params)
18
+ parsed_uri.to_s
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ <div class="row footer">
2
+ <div class="col-md-12 text-center mt-15">
3
+ © 2015 <a href="http://qwinixtech.com">Poodle Copyright Message</a>
4
+ </div>
5
+ </div>
@@ -0,0 +1,26 @@
1
+ <div class="header">
2
+
3
+ <ul class="nav nav-pills pull-right">
4
+ <%# if @current_user %>
5
+ <li class="dropdown">
6
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%#= @current_user.name %> User Name <b class="caret"></b></a>
7
+ <ul class="dropdown-menu">
8
+ <li class="dropdown-header">Profile</li>
9
+ <li><a href="#">Update Profile</a></li>
10
+ <li><a href="#">Profile Settings</a></li>
11
+ <li><a href="#">Notifications Settings</a></li>
12
+ <li class="divider"></li>
13
+ <li><%= link_to raw("Sign Out"), "#", method: :delete %></li>
14
+ </ul>
15
+ </li>
16
+ <%# else %>
17
+ <!-- <li class="<%= nav_class("Manage Page 1") %>">
18
+ <%#= link_to raw("Sign In"), "#" %>
19
+ </li> -->
20
+ <%# end %>
21
+
22
+ </ul>
23
+ <div class="cl-10"></div>
24
+ <div class="visible-xs" style="border:1px solid #c1c1c1;margin-bottom:20px"></div>
25
+ </div>
26
+
@@ -0,0 +1,45 @@
1
+ <h3 class="text-center">Poodle</h3>
2
+ <!-- <img src="http://www.domain.com/images/logo.png"/> -->
3
+ <div class="cl-30"></div>
4
+
5
+ <ul>
6
+
7
+ <li class="<%= nav_class("user/dashboard") %>">
8
+ <%= link_to raw("<i class=\"fa fa-dashboard\"></i> Dashboard"), "#" %>
9
+ </li>
10
+
11
+ <% if @current_user.is_admin? %>
12
+
13
+ <li class="heading">Admin</li>
14
+
15
+ <li class="<%= nav_class("admin/1") %>">
16
+ <%= link_to raw("<i class=\"fa fa-globe\"></i> Manage Admin 1"), "#" %>
17
+ </li>
18
+
19
+ <li class="<%= nav_class("admin/2") %>">
20
+ <%= link_to raw("<i class=\"fa fa-rub\"></i> Manage Admin 2"), "#" %>
21
+ </li>
22
+
23
+ <% end %>
24
+
25
+ <% if @current_user.is_super_admin? %>
26
+
27
+ <li class="heading">System Configuration</li>
28
+
29
+ <li class="<%= nav_class("super_admin/1") %>">
30
+ <%= link_to raw("<i class=\"fa fa-link\"></i> Configure 3"), "#" %>
31
+ </li>
32
+
33
+ <% end %>
34
+
35
+ <li class="heading">Account</li>
36
+
37
+ <li class="<%= nav_class("account/profile") %>">
38
+ <%= link_to raw("<i class=\"fa fa-user\"></i> My Profile"), "#" %>
39
+ </li>
40
+
41
+ <li>
42
+ <%= link_to raw("<i class=\"fa fa-power-off\"></i> Sign Out"), "#" %>
43
+ </li>
44
+ </ul>
45
+
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" class="no-js">
3
+ <head>
4
+ <title><%= title -%></title>
5
+ <%= render :partial=>"/layouts/poodle/common/meta_tags" -%>
6
+ <link rel="icon" href="/assets/favicon.ico" type="image/png">
7
+ <%= stylesheet_link_tag "poodle/application", :media => "all" -%>
8
+ <%= csrf_meta_tags -%>
9
+ <%= yield :javascript_header -%>
10
+ </head>
11
+ <body>
12
+
13
+ <div>
14
+
15
+ <div class="container-fluid with_sidebar header-block clearfix">
16
+
17
+ <%#* Display Sidebar -%>
18
+ <div class="sidebar">
19
+ <%= render :partial=>"/layouts/poodle/application/sidebar" -%>
20
+ </div>
21
+
22
+ <div class="main-content">
23
+ <div id="div_page_header">
24
+ <%= render :partial=>"/layouts/poodle/application/header" -%>
25
+ </div>
26
+
27
+ <%#* Show flash messages if controller has set any. -%>
28
+ <div id="div_flash_message" class="container-fluid" >
29
+ <%= render :partial=>"/layouts/poodle/common/flash_message" -%>
30
+ </div>
31
+
32
+ <%#* Page Content Starts here -%>
33
+ <div class="pt-10" style="min-height:400px;">
34
+ <%= yield %>
35
+ </div>
36
+
37
+ <%#* Display Footer -%>
38
+ <%= render :partial=>"/layouts/poodle/application/footer" -%>
39
+
40
+ </div>
41
+
42
+ </div>
43
+
44
+ </div>
45
+
46
+ <%#* Display Hidden Overlays -%>
47
+ <%= render :partial=>"/layouts/poodle/common/overlays" -%>
48
+
49
+ <%#* Loading Javascripts -%>
50
+ <%= javascript_include_tag "poodle/application" -%>
51
+
52
+ <%= yield :javascript_footer -%>
53
+
54
+ </body>
55
+
56
+ </html>
@@ -0,0 +1,46 @@
1
+ <%
2
+ unless defined?(required)
3
+ required = false
4
+ end
5
+ unless defined?(place_holder)
6
+ place_holder = ""
7
+ end
8
+ inp_id = "inp_#{display_name.underscore.split(" ").join("_")}"
9
+ error_class = object.errors[field_name.to_s].any? ? "has-errors" : ""
10
+ %>
11
+
12
+ <div class="form-group <%= error_class %>">
13
+
14
+ <% if ["text", "email", "search", "password", "date", "time", "tel", "url", "month", "file", "image", ""].include?(input_type) %>
15
+
16
+ <label for="inp_<%= display_name.underscore.split(" ").join("_") %>" class="col-md-4 control-label">
17
+ <%= display_name %>
18
+ <span class="text-color-red ml-10 mr-5 pull-right"><%= required ? "*" : raw("&nbsp;&nbsp;") %></span>
19
+ </label>
20
+ <div class="col-md-8">
21
+ <input name="<%= object_name %>[<%= field_name %>]" id="inp_<%= display_name.underscore.split(" ").join("_") %>" class="text input form-control" type="<%= input_type %>" placeholder="<%= place_holder %>" value="<%= object.send(field_name.to_s) %>" />
22
+ </div>
23
+
24
+ <% elsif input_type == "checkbox" %>
25
+
26
+ <label for="inp_<%= display_name.underscore.split(" ").join("_") %>" class="col-md-4 control-label">
27
+ <%= display_name %>
28
+ <span class="text-color-red ml-10 mr-5 pull-right"><%= required ? "*" : raw("&nbsp;&nbsp;") %></span>
29
+ </label>
30
+ <div class="col-md-8">
31
+ <input name="<%= object_name %>[<%= field_name %>]" id="inp_<%= display_name.underscore.split(" ").join("_") %>" type="<%= input_type %>" class="checkbox input form-control" <%= object.send(field_name.to_s) ? "checked='checked'" : "" %> />
32
+ </div>
33
+
34
+ <% elsif input_type == "textarea" %>
35
+
36
+ <label for="inp_<%= display_name.underscore.split(" ").join("_") %>" class="col-md-4 control-label">
37
+ <%= display_name %>
38
+ <span class="text-color-red ml-10 mr-5 pull-right"><%= required ? "*" : raw("&nbsp;&nbsp;") %></span>
39
+ </label>
40
+ <div class="col-md-8">
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
+ </div>
43
+
44
+ <% end %>
45
+
46
+ </div>
@@ -0,0 +1,23 @@
1
+ <%
2
+ if request.xhr?
3
+ flash_message = flash.now[:success] || flash.now[:notice] || flash.now[:alert] || flash.now[:error]
4
+ style_classes = ""
5
+ else
6
+ style_classes = ""
7
+ flash_message = flash[:success] || flash[:notice] || flash[:alert] || flash[:error]
8
+ end
9
+ cls_name = "alert-info"
10
+ cls_name = 'alert-success' if flash.now[:success] || flash[:success]
11
+ cls_name = 'alert-warning' if flash.now[:alert] || flash[:alert]
12
+ cls_name = 'alert-danger' if flash.now[:error] || flash[:error]
13
+
14
+ flash_message = flash_message.strip if flash_message
15
+
16
+ %>
17
+
18
+ <% unless flash_message.blank? %>
19
+ <div class="<%= style_classes %> alert <%= cls_name %> fade in mb-10" data-alert="alert">
20
+ <a class="close" data-dismiss='alert' href="#">×</a>
21
+ <p><%= flash_message %></p>
22
+ </div>
23
+ <% end %>
@@ -0,0 +1,42 @@
1
+
2
+ <%# meta tags%>
3
+ <% if @meta_tags %>
4
+ <% if @meta_tags[:rel_prev] %>
5
+ <link rel="prev" href="<%%= @meta_tags[:rel_prev] %>" />
6
+ <% end %>
7
+ <% if @meta_tags[:rel_next] %>
8
+ <link rel="next" href="<%%= @meta_tags[:rel_next] %>" />
9
+ <% end %>
10
+ <% if @meta_tags[:canonical] %>
11
+ <link rel="canonical" href="<%%= @meta_tags[:canonical] %>" />
12
+ <% end %>
13
+ <% if @meta_tags[:meta_description] %>
14
+ <meta name="description" content="<%%= @meta_tags[:meta_description] %>"></meta>
15
+ <% else %>
16
+ <meta name="description" content="Twitter Like App = A learning app."></meta>
17
+ <% end %>
18
+ <% if @meta_tags[:meta_keywords] %>
19
+ <meta name="keywords" content="<%%= @meta_tags[:meta_keywords] %>"></meta>
20
+ <% else %>
21
+ <% meta_keywords = "Twitter Like App = A learning app." %>
22
+ <meta name="keywords" content="<%%= meta_keywords %>"></meta>
23
+ <% end %>
24
+ <% if @meta_tags[:robots] %>
25
+ <meta name="robots" content="<%%= @meta_tags[:robots] %>" />
26
+ <% else %>
27
+ <meta name="robots" content="all" />
28
+ <% end %>
29
+ <% end %>
30
+
31
+ <meta charset="utf-8">
32
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
33
+ <meta name="copyright" content="2014 kpvarma" />
34
+ <meta name="content-language" content="en" />
35
+ <meta name="author" content="K P Varma" />
36
+ <meta name="resource-type" content="document" />
37
+ <meta name="distribution" content="global" />
38
+ <meta name="rating" content="general" />
39
+
40
+
41
+
42
+
@@ -0,0 +1,28 @@
1
+ <div id="div_modal_generic" class="modal fade">
2
+ <div class="modal-dialog">
3
+ <div class="modal-content">
4
+ <div class="modal-header">
5
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
6
+ <h4 class="modal-title">Modal title</h4>
7
+ </div>
8
+ <div class="modal-body-main"></div>
9
+ </div><!-- /.modal-content -->
10
+ </div><!-- /.modal-dialog -->
11
+ </div><!-- /.modal -->
12
+
13
+ <div id="div_modal_message" class="modal fade">
14
+ <div class="modal-dialog">
15
+ <div class="modal-content">
16
+ <div class="modal-header">
17
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
18
+ <h4 class="modal-title">Modal title</h4>
19
+ </div>
20
+ <div class="modal-body">
21
+ <p>One fine body&hellip;</p>
22
+ </div>
23
+ <div class="modal-footer">
24
+ <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
25
+ </div>
26
+ </div><!-- /.modal-content -->
27
+ </div><!-- /.modal-dialog -->
28
+ </div><!-- /.modal -->