brightcontent-core 2.0.33 → 2.1.0

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 (105) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/app/assets/javascripts/brightcontent/brightcontent.js.erb +8 -0
  4. data/app/assets/javascripts/brightcontent/core.js.coffee +28 -0
  5. data/app/assets/javascripts/brightcontent/wysithtml5-parser-rules.js +519 -0
  6. data/app/assets/stylesheets/brightcontent/brightcontent.css.erb +10 -0
  7. data/app/assets/stylesheets/brightcontent/core.css.sass +61 -0
  8. data/app/assets/stylesheets/brightcontent/signin.css.sass +34 -0
  9. data/app/controllers/brightcontent/admin_users_controller.rb +1 -3
  10. data/app/controllers/brightcontent/application_controller.rb +12 -2
  11. data/app/controllers/brightcontent/base_controller.rb +7 -18
  12. data/app/controllers/brightcontent/sessions_controller.rb +1 -1
  13. data/app/helpers/brightcontent/application_helper.rb +4 -0
  14. data/app/helpers/brightcontent/base_helper.rb +6 -18
  15. data/app/helpers/brightcontent/translation_helper.rb +38 -0
  16. data/app/views/brightcontent/application/_menu.html.erb +9 -2
  17. data/app/views/brightcontent/application/_resource.html.erb +3 -0
  18. data/app/views/brightcontent/application/_show_flash_names.html.erb +2 -1
  19. data/app/views/brightcontent/application/_user_menu.html.erb +4 -0
  20. data/app/views/brightcontent/base/_form.html.erb +16 -11
  21. data/app/views/brightcontent/base/_list_actions.html.erb +2 -2
  22. data/app/views/brightcontent/base/_list_filters.html.erb +12 -0
  23. data/app/views/brightcontent/base/_list_header.html.erb +6 -0
  24. data/app/views/brightcontent/base/_list_item.html.erb +6 -0
  25. data/app/views/brightcontent/base/edit.html.erb +0 -2
  26. data/app/views/brightcontent/{fields → base/form_fields}/_file.html.erb +0 -0
  27. data/app/views/brightcontent/base/index.html.erb +9 -11
  28. data/app/views/brightcontent/base/list_fields/_boolean.html.erb +5 -0
  29. data/app/views/brightcontent/base/new.html.erb +0 -2
  30. data/app/views/brightcontent/sessions/new.html.erb +5 -11
  31. data/app/views/layouts/brightcontent/application.html.erb +34 -29
  32. data/bin/autospec +16 -0
  33. data/bin/rspec +16 -0
  34. data/brightcontent-core.gemspec +11 -6
  35. data/config/initializers/simple_form.rb +18 -15
  36. data/config/initializers/simple_form_bootstrap.rb +46 -30
  37. data/config/locales/brightcontent_core.en.yml +30 -0
  38. data/config/locales/brightcontent_core.nl.yml +30 -0
  39. data/config/routes.rb +1 -1
  40. data/db/migrate/20121206121725_create_brightcontent_admin_users.rb +1 -1
  41. data/lib/brightcontent/base_controller_ext/default_actions.rb +35 -0
  42. data/lib/brightcontent/base_controller_ext/fields.rb +36 -0
  43. data/lib/brightcontent/base_controller_ext/filtering.rb +21 -0
  44. data/lib/brightcontent/base_controller_ext/pagination.rb +29 -0
  45. data/lib/brightcontent/base_controller_ext.rb +8 -0
  46. data/lib/brightcontent/core.rb +24 -10
  47. data/lib/brightcontent/engine.rb +6 -0
  48. data/lib/brightcontent/resource.rb +15 -0
  49. data/lib/brightcontent/resources.rb +25 -0
  50. data/lib/brightcontent/routes_parser.rb +9 -17
  51. data/lib/brightcontent/view_lookup/abstract.rb +49 -0
  52. data/lib/brightcontent/view_lookup/filter_field.rb +57 -0
  53. data/lib/brightcontent/view_lookup/form_field.rb +14 -0
  54. data/lib/brightcontent/view_lookup/list_field.rb +13 -0
  55. data/lib/brightcontent/view_lookup.rb +8 -0
  56. data/lib/generators/brightcontent/templates/brightcontent_controller.rb +1 -1
  57. data/lib/generators/brightcontent/templates/initializer.rb +14 -2
  58. data/spec/dummy/app/controllers/brightcontent/blogs_controller.rb +1 -1
  59. data/spec/dummy/app/models/author.rb +7 -0
  60. data/spec/dummy/app/models/blog.rb +2 -1
  61. data/spec/dummy/config/application.rb +2 -6
  62. data/spec/dummy/config/environments/development.rb +1 -10
  63. data/spec/dummy/config/environments/production.rb +0 -4
  64. data/spec/dummy/config/environments/test.rb +2 -6
  65. data/spec/dummy/config/initializers/secret_token.rb +1 -1
  66. data/spec/dummy/db/migrate/20130720211920_create_comments.rb +0 -1
  67. data/spec/dummy/db/migrate/20140512085432_add_author_id_to_blogs.rb +5 -0
  68. data/spec/dummy/db/migrate/20140512090832_create_authors.rb +9 -0
  69. data/spec/dummy/db/schema.rb +19 -12
  70. data/spec/factories.rb +15 -0
  71. data/spec/features/login_spec.rb +3 -3
  72. data/spec/features/menu_spec.rb +2 -4
  73. data/spec/features/nested_resource_spec.rb +1 -1
  74. data/spec/features/resources_form_spec.rb +1 -3
  75. data/spec/features/resources_index_spec.rb +30 -6
  76. data/spec/helpers/brightcontent/translation_helper_spec.rb +27 -0
  77. data/spec/lib/brightcontent/model_extensions_spec.rb +1 -1
  78. data/spec/lib/brightcontent/resource_spec.rb +16 -0
  79. data/spec/lib/brightcontent/resources_spec.rb +67 -0
  80. data/spec/lib/brightcontent/routes_parser_spec.rb +4 -9
  81. data/spec/lib/brightcontent/view_lookup/abstract_spec.rb +40 -0
  82. metadata +159 -70
  83. data/app/assets/images/brightcontent/.gitkeep +0 -0
  84. data/app/assets/images/brightcontent/glyphicons-halflings-white.png +0 -0
  85. data/app/assets/images/brightcontent/glyphicons-halflings.png +0 -0
  86. data/app/assets/javascripts/brightcontent/attachments.js +0 -0
  87. data/app/assets/javascripts/brightcontent/bootstrap.min.js +0 -6
  88. data/app/assets/javascripts/brightcontent/brightcontent.js +0 -21
  89. data/app/assets/javascripts/brightcontent/main.js +0 -26
  90. data/app/assets/javascripts/brightcontent/pages.js +0 -0
  91. data/app/assets/stylesheets/brightcontent/attachments.css +0 -0
  92. data/app/assets/stylesheets/brightcontent/bootstrap-responsive.min.css +0 -9
  93. data/app/assets/stylesheets/brightcontent/bootstrap.min.css +0 -9
  94. data/app/assets/stylesheets/brightcontent/brightcontent.css +0 -19
  95. data/app/assets/stylesheets/brightcontent/main.css +0 -95
  96. data/app/assets/stylesheets/brightcontent/pages.css +0 -0
  97. data/app/views/brightcontent/base/_index_top.html.erb +0 -0
  98. data/app/views/brightcontent/base/_list.html.erb +0 -8
  99. data/app/views/brightcontent/base/_scope_filters.html.erb +0 -9
  100. data/config/initializers/will_paginate.rb +0 -28
  101. data/config/locales/brightcontent.en.yml +0 -10
  102. data/config/locales/brightcontent.nl.yml +0 -10
  103. data/lib/brightcontent/default_actions.rb +0 -28
  104. data/lib/brightcontent/pagination.rb +0 -28
  105. data/spec/features/scope_spec.rb +0 -27
@@ -1,9 +1,20 @@
1
1
  module Brightcontent
2
2
  class ApplicationController < ActionController::Base
3
+ add_flash_types :success, :info, :warning, :danger
3
4
  before_filter :authorize
5
+ before_filter :set_locale
6
+ helper TranslationHelper
7
+
8
+ def index
9
+ redirect_to root_path + user_resources.first.path
10
+ end
4
11
 
5
12
  private
6
13
 
14
+ def set_locale
15
+ I18n.locale = Brightcontent.locale
16
+ end
17
+
7
18
  def current_user
8
19
  @current_user ||= AdminUser.find(session[:brightcontent_user_id]) if session[:brightcontent_user_id]
9
20
  end
@@ -15,8 +26,7 @@ module Brightcontent
15
26
  helper_method :user_resources
16
27
 
17
28
  def authorize
18
- redirect_to login_url if current_user.nil?
29
+ redirect_to login_url unless current_user
19
30
  end
20
-
21
31
  end
22
32
  end
@@ -4,32 +4,22 @@ require_dependency "brightcontent/application_controller"
4
4
  module Brightcontent
5
5
  class BaseController < ApplicationController
6
6
  inherit_resources
7
- helper_method :scopes_configuration
8
7
  respond_to :all
9
8
 
10
- include DefaultActions
11
- include Pagination
9
+ include BaseControllerExt::DefaultActions
10
+ include BaseControllerExt::Pagination
11
+ include BaseControllerExt::Fields
12
+ include BaseControllerExt::Filtering
12
13
 
13
14
  def permitted_params
14
15
  params.permit!
15
16
  end
16
17
 
17
- protected
18
-
19
- def list_fields
20
- default_fields - %w{attachments}
21
- end
22
- helper_method :list_fields
23
-
24
- def form_fields
25
- default_fields
18
+ def resource_params
19
+ [permitted_params[resource_instance_name]]
26
20
  end
27
- helper_method :form_fields
28
21
 
29
- def default_fields
30
- resource_class.brightcontent_columns - %w{id created_at updated_at password_digest}
31
- end
32
- helper_method :default_fields
22
+ protected
33
23
 
34
24
  def parent
35
25
  super if parent?
@@ -45,6 +35,5 @@ module Brightcontent
45
35
  [parent, resource_class]
46
36
  end
47
37
  helper_method :resource_index_path
48
-
49
38
  end
50
39
  end
@@ -11,7 +11,7 @@ module Brightcontent
11
11
  session[:brightcontent_user_id] = user.id
12
12
  redirect_to root_url
13
13
  else
14
- flash.now.alert = "Email or password is invalid"
14
+ flash.now[:danger] = "Email or password is invalid"
15
15
  render :new
16
16
  end
17
17
  end
@@ -1,4 +1,8 @@
1
1
  module Brightcontent
2
2
  module ApplicationHelper
3
+ def avatar_url(user)
4
+ gravatar_id = Digest::MD5.hexdigest(user.email.downcase)
5
+ "https://gravatar.com/avatar/#{gravatar_id}.png?s=30&d=mm"
6
+ end
3
7
  end
4
8
  end
@@ -1,33 +1,21 @@
1
1
  module Brightcontent
2
2
  module BaseHelper
3
3
  def render_list_field(item, field)
4
- render_if_exists("list_field_#{field}", item: item) || item.send(field).to_s.truncate(50)
4
+ ViewLookup::ListField.new(self, item: item, field: field).call
5
5
  end
6
6
 
7
- def render_form_field(form, field)
8
- render_if_exists("form_field_#{field}", form: form, item: form.object) ||
9
- render_if_exists("brightcontent/fields/#{field_type(form, field)}", form: form, item: form.object, field: field) ||
10
- form.input(field.to_sym)
7
+ def render_filter_field(form, field)
8
+ ViewLookup::FilterField.new(self, field: field, form: form).call
11
9
  end
12
10
 
13
- def link_for_scope(scope)
14
- case scope[:type]
15
- when :boolean
16
- polymorphic_url(resource_index_path, scope[:as] => true)
17
- end
11
+ def render_form_field(form, field)
12
+ ViewLookup::FormField.new(self, item: form.object, field: field, form: form).call
18
13
  end
19
14
 
20
- private
21
-
22
15
  def render_if_exists(*args)
23
- render *args
16
+ render(*args)
24
17
  rescue ActionView::MissingTemplate
25
18
  nil
26
19
  end
27
-
28
- def field_type(form, field)
29
- column = form.send(:find_attribute_column, field)
30
- form.send(:default_input_type, field, column, {})
31
- end
32
20
  end
33
21
  end
@@ -0,0 +1,38 @@
1
+ module Brightcontent
2
+ module TranslationHelper
3
+
4
+ # http://en.wiktionary.org/wiki/nominative_case
5
+ #
6
+ # This implementation works fine for Germanic languages and it will fail
7
+ # horribly at Slavic languages or Arabic. Support for true declensions
8
+ # could be added later though.
9
+ #
10
+ # This method exists because:
11
+ # - we don't want to abuse #human(count: 2) because that should return
12
+ # something like "2 Users" and not just "Users". It's not meant to say
13
+ # things like: "These are users"
14
+ # - we want to avoid feeding the current locale to #pluralize the whole time
15
+ #
16
+ # nominative_plural("thing") => "things"
17
+ # nominative_plural(User) => "users"
18
+ # or if I18n.locale == :nl
19
+ # nominative_plural(User) => "gebruikers"
20
+ # nominative_plural("thing") => "dingen"
21
+ def nominative_plural(thing)
22
+ if thing.respond_to? :model_name
23
+ nominative_plural(thing.model_name.human)
24
+ else
25
+ I18n.t "#{thing}.title", default: thing.to_s.pluralize(I18n.locale)
26
+ end
27
+ end
28
+
29
+ def nominative_singular(thing)
30
+ if thing.respond_to? :model_name
31
+ nominative_singular(thing.model_name.human)
32
+ else
33
+ I18n.t "#{thing}.title", default: thing.to_s.singularize(I18n.locale)
34
+ end
35
+ end
36
+
37
+ end
38
+ end
@@ -1,3 +1,10 @@
1
- <% user_resources.each do |resource| %>
2
- <li><%= link_to resource.klass.model_name.human.pluralize, root_path + resource.path %></li>
1
+ <%= render user_resources.main_menu %>
2
+
3
+ <% if user_resources.extra_menu? %>
4
+ <li class="dropdown">
5
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Extra <b class="caret"></b></a>
6
+ <ul class="dropdown-menu">
7
+ <%= render user_resources.extra_menu %>
8
+ </ul>
9
+ </li>
3
10
  <% end %>
@@ -0,0 +1,3 @@
1
+ <li class="<%= 'active' if resource_class == resource.klass %>">
2
+ <%= link_to nominative_plural(resource.klass).capitalize, root_path + resource.path %>
3
+ </li>
@@ -1,5 +1,6 @@
1
1
  <% flash.each do |key,value| %>
2
- <div class="alert alert-<%= key.to_s%>">
2
+ <div class="alert alert-info">
3
+ <a class="close" data-dismiss="alert" href="#" aria-hidden="true">&times;</a>
3
4
  <%= value %>
4
5
  </div>
5
6
  <% end %>
@@ -0,0 +1,4 @@
1
+ <li><%= link_to "Homepage", "/" %></li>
2
+ <li><%= link_to Brightcontent::AdminUser.model_name.human.pluralize, admin_users_path %></li>
3
+ <li class="divider"></li>
4
+ <li><%= link_to t('brightcontent.logout'), logout_path %></li>
@@ -1,17 +1,22 @@
1
- <%= simple_form_for resource_item_path do |form| -%>
1
+ <%= simple_form_for resource_item_path do |form| %>
2
2
  <%= form.error_notification %>
3
3
 
4
- <div class="form-inputs">
5
- <% form_fields.each do |form_field| -%>
6
- <%= render_form_field(form, form_field) -%>
7
- <% end -%>
4
+ <div class="page-header">
5
+ <h1><%= t('brightcontent.' + (resource.new_record? ? 'create_new' : 'edit_model'), model: resource_class.model_name.human).capitalize %></h1>
8
6
  </div>
9
7
 
10
- <%= form.button :submit, class: "btn btn-primary" %>
11
- <%= form.button :submit, "Save and continue", :name => "commit_and_continue" %>
8
+ <div class="panel-body form-fields">
9
+ <% form_fields.each do |form_field| %>
10
+ <%= render_form_field(form, form_field) %>
11
+ <% end %>
12
+ </div>
12
13
 
13
- <% unless resource.new_record? -%>
14
- <%= link_to "Delete", resource_item_path, :class => "btn btn-danger delete", :method => :delete, :data => { :confirm => 'Are you sure?' } %>
15
- <% end -%>
14
+ <div class="panel-footer">
15
+ <%= form.button :submit, class: "btn btn-primary" %>
16
+ <%= form.button :submit, t('brightcontent.save_and_continue'), class: "btn btn-default", name: "commit_and_continue" %>
16
17
 
17
- <% end -%>
18
+ <% unless resource.new_record? %>
19
+ <%= link_to t('brightcontent.delete'), resource_item_path, class: "btn btn-danger pull-right", method: :delete, data: { confirm: 'Are you sure?' } %>
20
+ <% end %>
21
+ </div>
22
+ <% end %>
@@ -1,2 +1,2 @@
1
- <%= link_to "Edit", [:edit, parent, item], class: "btn btn-mini btn-primary" %>
2
- <%= link_to "Delete", [parent, item], class: "btn btn-mini", confirm: 'Are you sure?', method: :delete %>
1
+ <%= link_to t('brightcontent.edit'), [:edit, parent, item], class: "btn btn-xs btn-primary" %>
2
+ <%= link_to t('brightcontent.delete'), [parent, item], class: "btn btn-xs btn-danger", data: {confirm: t('brightcontent.are_you_sure')}, method: :delete %>
@@ -0,0 +1,12 @@
1
+ <% if filter_fields.present? %>
2
+ <div class="panel-body">
3
+ <%= search_form_for ransack_search, class: "form-inline" do |form| %>
4
+ <% filter_fields.each do |field| %>
5
+ <div class="form-group">
6
+ <%= render_filter_field form, field %>
7
+ </div>
8
+ <% end %>
9
+ <%= form.submit class: "btn btn-default btn-sm" %>
10
+ <% end %>
11
+ </div>
12
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <div class="page-header">
2
+ <%= link_to "#{I18n.t('brightcontent.create_new', model: resource_class.model_name.human).capitalize}", polymorphic_url(resource_index_path, action: :new), class: "btn btn-primary pull-right" %>
3
+ <h1><%= nominative_plural(resource_class).capitalize %></h1>
4
+ </div>
5
+
6
+ <%= render_if_exists "index_top" %>
@@ -0,0 +1,6 @@
1
+ <%= content_tag_for :tr, item do %>
2
+ <% list_fields.each do |field| %>
3
+ <td><%= render_list_field(item, field) %></td>
4
+ <% end %>
5
+ <td class="list-actions"><%= render "list_actions", item: item %></td>
6
+ <% end %>
@@ -1,3 +1 @@
1
- <h1>Edit <%= resource_class.model_name.human %></h1>
2
-
3
1
  <%= render "form" %>
@@ -1,25 +1,23 @@
1
- <div id="overview">
1
+ <%= render "list_header" %>
2
2
 
3
- <%= link_to "Create new #{resource_instance_name.to_s.humanize}", polymorphic_url(resource_index_path, action: :new), class: "btn btn-primary btn-right" %>
4
- <h1><%= resource_class.model_name.human.pluralize %></h1>
3
+ <%= render "list_filters" %>
5
4
 
6
- <%= render "scope_filters" if scopes_configuration %>
7
- <%= render "index_top" %>
8
-
9
- <table class="table table-hover">
5
+ <div class="table-responsive">
6
+ <table class="table table-hover <%= dom_class(resource_class, :table) %>">
10
7
  <thead>
11
8
  <tr>
12
9
  <% list_fields.each do |list_field| %>
13
- <th><%= list_field.humanize %></th>
10
+ <th><%= resource_class.human_attribute_name(list_field) %></th>
14
11
  <% end %>
15
12
  <th></th>
16
13
  </tr>
17
14
  </thead>
18
15
  <tbody>
19
- <%= render "list", collection: collection, list_fields: list_fields %>
16
+ <%= render partial: 'list_item', collection: collection, as: :item %>
20
17
  </tbody>
21
18
  </table>
19
+ </div>
22
20
 
23
- <%= will_paginate collection %>
24
-
21
+ <div class="panel-footer panel-footer-pagination">
22
+ <%= will_paginate collection, renderer: BootstrapPagination::Rails %>
25
23
  </div>
@@ -0,0 +1,5 @@
1
+ <% if item.send(field) %>
2
+ <span class="glyphicon glyphicon-ok"></span>
3
+ <% else %>
4
+ <span class="list-false">&times;</span>
5
+ <% end %>
@@ -1,3 +1 @@
1
- <h1>Create new <%= resource_instance_name.to_s %></h1>
2
-
3
1
  <%= render "form" %>
@@ -1,12 +1,6 @@
1
- <%= form_tag sessions_path, class: "form-signin" do %>
2
- <h2>Please sign in</h2>
3
- <div class="field">
4
- <%= label_tag :email %>
5
- <%= text_field_tag :email, params[:email] %>
6
- </div>
7
- <div class="field">
8
- <%= label_tag :password %>
9
- <%= password_field_tag :password %>
10
- </div>
11
- <%= submit_tag "Login", class: "btn btn-large btn-primary" %>
1
+ <%= form_tag sessions_path, class: "form-signin", role: 'form' do %>
2
+ <h2 class="form-signin-heading"><%=t('brightcontent.sign_in')%></h2>
3
+ <%= text_field_tag :email, params[:email], class: 'form-control', placeholder: 'Email', autofocus: true %>
4
+ <%= password_field_tag :password, nil, class: 'form-control', placeholder: 'Password' %>
5
+ <%= submit_tag "Login", class: "btn btn-lg btn-primary btn-block" %>
12
6
  <% end %>
@@ -3,52 +3,57 @@
3
3
  <head>
4
4
  <title>Brightcontent</title>
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <%= stylesheet_link_tag "brightcontent/brightcontent", :media => "all" %>
7
- <%= javascript_include_tag "brightcontent/brightcontent" %>
6
+ <meta name="robots" content="noindex" />
7
+ <%= stylesheet_link_tag "brightcontent/brightcontent", :media => "all" %>
8
+ <%= yield :head %>
8
9
  <%= csrf_meta_tags %>
9
10
  <!--[if lt IE 9]>
10
- <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
11
+ <script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
11
12
  <![endif]-->
12
13
  </head>
13
- <body>
14
-
15
14
 
15
+ <body data-editor-locale="<%=t('brightcontent.editor_locale')%>">
16
16
  <% if current_user %>
17
- <div class="navbar">
18
- <div class="navbar-inner">
19
- <div class="container">
20
- <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
17
+ <div class="navbar navbar-inverse navbar-bc navbar-static-top" role="navigation">
18
+ <div class="container">
19
+ <div class="navbar-header">
20
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
21
+ <span class="sr-only">Toggle navigation</span>
21
22
  <span class="icon-bar"></span>
22
23
  <span class="icon-bar"></span>
23
24
  <span class="icon-bar"></span>
24
- </a>
25
- <%= link_to Brightcontent.application_name, root_path, class: "brand" %>
26
- <div class="nav-collapse collapse">
27
- <ul class="nav" id="menu">
28
- <%= render "menu" %>
29
- </ul>
30
- <ul class="nav pull-right">
31
- <li class="dropdown">
32
- <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= current_user.email %><b class="caret"></b></a>
33
- <ul class="dropdown-menu">
34
- <li><%= link_to "Homepage", "/" %></li>
35
- <li><%= link_to "Admins", admin_users_path %></li>
36
- <li><%= link_to "Logout", logout_path %></li>
37
- <ul>
38
- </li>
25
+ </button>
26
+ <%= link_to Brightcontent.application_name, root_path, class: "navbar-brand" %>
27
+ </div>
28
+ <div class="navbar-collapse collapse">
29
+ <ul class="nav navbar-nav js-menu">
30
+ <%= render "menu" %>
31
+ </ul>
32
+ <ul class="nav navbar-nav navbar-right">
33
+ <li class="dropdown">
34
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
35
+ <%= image_tag avatar_url(current_user), class: 'avatar' %>
36
+ <%= current_user.email %><b class="caret"></b>
37
+ </a>
38
+ <ul class="dropdown-menu">
39
+ <%= render "brightcontent/application/user_menu" %>
39
40
  </ul>
40
- </div>
41
+ </li>
42
+ </ul>
41
43
  </div>
42
44
  </div>
43
45
  </div>
44
46
  <% end %>
45
47
 
46
- <div class="container <%= "box" unless controller.controller_name == 'sessions' %>">
47
- <%= render "brightcontent/application/show_flash_names" %>
48
- <%= yield %>
48
+ <div class="container">
49
+ <div class="<%= "panel panel-default" unless controller.controller_name == 'sessions' %>">
50
+ <%= render "brightcontent/application/show_flash_names" %>
51
+ <%= yield %>
52
+ </div>
49
53
  </div>
50
-
51
54
  </div>
52
55
 
56
+ <%= javascript_include_tag "brightcontent/brightcontent" %>
57
+ <%= yield :bottom %>
53
58
  </body>
54
59
  </html>
data/bin/autospec ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'autospec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'autospec')
data/bin/rspec ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # This file was generated by Bundler.
4
+ #
5
+ # The application 'rspec' is installed as part of a gem, and
6
+ # this file is here to facilitate running it.
7
+ #
8
+
9
+ require 'pathname'
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",
11
+ Pathname.new(__FILE__).realpath)
12
+
13
+ require 'rubygems'
14
+ require 'bundler/setup'
15
+
16
+ load Gem.bin_path('rspec-core', 'rspec')
@@ -15,17 +15,22 @@ Gem::Specification.new do |s|
15
15
  s.test_files = `git ls-files -- spec/*`.split("\n")
16
16
  s.require_paths = ["lib"]
17
17
 
18
- s.add_dependency "rails", ">= 3.2.13"
18
+ s.add_dependency "rails", ">= 4.0.0"
19
+ s.add_dependency "bcrypt-ruby"
20
+ s.add_dependency "bootstrap-sass", "~> 3.1"
21
+ s.add_dependency "bootstrap-wysihtml5-rails"
22
+ s.add_dependency "coffee-rails"
23
+ s.add_dependency "inherited_resources", ">= 1.4.1"
19
24
  s.add_dependency "jquery-rails"
20
- s.add_dependency "bcrypt-ruby", ">= 3.0.0"
21
- s.add_dependency "inherited_resources"
22
- s.add_dependency "has_scope"
25
+ s.add_dependency "sass-rails", ">= 4.0.2"
23
26
  s.add_dependency "simple_form"
24
27
  s.add_dependency "will_paginate"
25
- s.add_dependency "bootstrap-wysihtml5-rails"
26
- s.add_dependency "strong_parameters"
28
+ s.add_dependency "will_paginate-bootstrap"
29
+ s.add_dependency "ransack", "~> 1.1"
27
30
 
31
+ s.add_development_dependency "rake"
28
32
  s.add_development_dependency "sqlite3"
33
+ s.add_development_dependency "rspec"
29
34
  s.add_development_dependency "rspec-rails"
30
35
  s.add_development_dependency "capybara"
31
36
  s.add_development_dependency "launchy"
@@ -5,8 +5,8 @@ SimpleForm.setup do |config|
5
5
  # wrapper, change the order or even add your own to the
6
6
  # stack. The options given below are used to wrap the
7
7
  # whole input.
8
- config.wrappers :default, :class => :input,
9
- :hint_class => :field_with_hint, :error_class => :field_with_errors do |b|
8
+ config.wrappers :default, class: :input,
9
+ hint_class: :field_with_hint, error_class: :field_with_errors do |b|
10
10
  ## Extensions enabled by default
11
11
  # Any of these extensions can be disabled for a
12
12
  # given input by passing: `f.input EXTENSION_NAME => false`.
@@ -18,7 +18,7 @@ SimpleForm.setup do |config|
18
18
  b.use :html5
19
19
 
20
20
  # Calculates placeholders automatically from I18n
21
- # You can also pass a string as f.input :placeholder => "Placeholder"
21
+ # You can also pass a string as f.input placeholder: "Placeholder"
22
22
  b.use :placeholder
23
23
 
24
24
  ## Optional extensions
@@ -41,8 +41,8 @@ SimpleForm.setup do |config|
41
41
 
42
42
  ## Inputs
43
43
  b.use :label_input
44
- b.use :hint, :wrap_with => { :tag => :span, :class => :hint }
45
- b.use :error, :wrap_with => { :tag => :span, :class => :error }
44
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
45
+ b.use :error, wrap_with: { tag: :span, class: :error }
46
46
  end
47
47
 
48
48
  # The default wrapper to be used by the FormBuilder.
@@ -50,8 +50,8 @@ SimpleForm.setup do |config|
50
50
 
51
51
  # Define the way to render check boxes / radio buttons with labels.
52
52
  # Defaults to :nested for bootstrap config.
53
- # :inline => input + label
54
- # :nested => label > input
53
+ # inline: input + label
54
+ # nested: label > input
55
55
  config.boolean_style = :nested
56
56
 
57
57
  # Default class for buttons
@@ -66,7 +66,7 @@ SimpleForm.setup do |config|
66
66
  config.error_notification_tag = :div
67
67
 
68
68
  # CSS class to add for error notification helper.
69
- config.error_notification_class = 'alert alert-error'
69
+ config.error_notification_class = 'alert alert-danger'
70
70
 
71
71
  # ID to add for error notification helper.
72
72
  # config.error_notification_id = nil
@@ -95,7 +95,7 @@ SimpleForm.setup do |config|
95
95
  # config.label_text = lambda { |label, required| "#{required} #{label}" }
96
96
 
97
97
  # You can define the class to use on all labels. Default is nil.
98
- config.label_class = 'control-label'
98
+ config.label_class = 'control-label col-sm-2'
99
99
 
100
100
  # You can define the class to use on all forms. Default is simple_form.
101
101
  config.form_class = 'form-horizontal'
@@ -106,8 +106,11 @@ SimpleForm.setup do |config|
106
106
  # Whether attributes are required by default (or not). Default is true.
107
107
  # config.required_by_default = true
108
108
 
109
- # Tell browsers whether to use default HTML5 validations (novalidate option).
110
- # Default is enabled.
109
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
110
+ # These validations are enabled in SimpleForm's internal config but disabled by default
111
+ # in this configuration, which is recommended due to some quirks from different browsers.
112
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
113
+ # change this configuration to true.
111
114
  config.browser_validations = false
112
115
 
113
116
  # Collection of methods to detect if a file type was given.
@@ -120,7 +123,7 @@ SimpleForm.setup do |config|
120
123
 
121
124
  # Custom wrappers for input types. This should be a hash containing an input
122
125
  # type as key and the wrapper that will be used for all inputs with specified type.
123
- # config.wrapper_mappings = { :string => :prepend }
126
+ # config.wrapper_mappings = { string: :prepend }
124
127
 
125
128
  # Default priority for time_zone inputs.
126
129
  # config.time_zone_priority = nil
@@ -128,9 +131,6 @@ SimpleForm.setup do |config|
128
131
  # Default priority for country inputs.
129
132
  # config.country_priority = nil
130
133
 
131
- # Default size for text inputs.
132
- # config.default_input_size = 50
133
-
134
134
  # When false, do not use translations for labels.
135
135
  # config.translate_labels = true
136
136
 
@@ -139,4 +139,7 @@ SimpleForm.setup do |config|
139
139
 
140
140
  # Cache SimpleForm inputs discovery
141
141
  config.cache_discovery = !Rails.env.development?
142
+
143
+ # Default class for inputs
144
+ # config.input_class = nil
142
145
  end