brightcontent-core 2.4.6 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c53289cd30fd901707edf389707dd97744ab8aed
4
- data.tar.gz: 788c93a2d4276f1548eb4ce250a897d0f86210fa
2
+ SHA256:
3
+ metadata.gz: 64042327f76b07e28af6149a59ea8227b24c9f509b872f48fa2432d3983761af
4
+ data.tar.gz: 7a3c3459ef1dbebe87f2da33d83d7ff465f595d2a332f56c3bbd3d0247799c18
5
5
  SHA512:
6
- metadata.gz: 7afb009f1d98a1a444485d87132cf6e21eda2ee0f6a8fa7b8b15d0af5c6d7533c885bf2769f28e7ff860995adf0b1ba7efe784fbda1b21c60b4ad9a9d119f76a
7
- data.tar.gz: 9e850c5f47d5906c78863802e6dbfb65bad5c2d43eb430700a3ae84705affeb6871b9188e0a1027683ec82cbe708b9e51f5d9ba147f672d40c105877602fdb97
6
+ metadata.gz: '0417833d970787c91c85c958404c0f806fcf42b6c34867184454e363fb47b8d545180a2c95aba05765df3a71b0707f4abbdc5bed82117e4c5afe90db75cd835c'
7
+ data.tar.gz: a5281483e8c1ded0e7e79c2ba6c608614cbded7a7380029199afe2fc991348eacce55154aafd23e36af75790e24dfad940e3db774000e86deb1c9693590addfe
@@ -23,7 +23,7 @@ module Brightcontent
23
23
  def current_user
24
24
  @current_user ||= begin
25
25
  Brightcontent.user_model.find(session[:brightcontent_user_id]) if session[:brightcontent_user_id]
26
- end
26
+ end.tap { |u| logger.info "Current Brightcontent user: #{u&.to_gid}" }
27
27
  end
28
28
  helper_method :current_user
29
29
 
@@ -20,5 +20,5 @@
20
20
 
21
21
  <div class="panel-footer panel-footer-pagination">
22
22
  <%= render partial: "page_sizes" %>
23
- <%= will_paginate collection, class: :pages, renderer: BootstrapPagination::Rails %>
23
+ <%= will_paginate collection, class: :pages, renderer: Brightcontent::PaginationRenderer %>
24
24
  </div>
@@ -0,0 +1,4 @@
1
+ <div class="<%= "panel panel-default" unless controller.controller_name == 'sessions' %>">
2
+ <%= render "brightcontent/application/show_flash_names" %>
3
+ <%= yield %>
4
+ </div>
@@ -0,0 +1,31 @@
1
+ <% if current_user %>
2
+ <div class="navbar navbar-inverse navbar-bc navbar-static-top" role="navigation">
3
+ <div class="container">
4
+ <div class="navbar-header">
5
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
6
+ <span class="sr-only">Toggle navigation</span>
7
+ <span class="icon-bar"></span>
8
+ <span class="icon-bar"></span>
9
+ <span class="icon-bar"></span>
10
+ </button>
11
+ <%= link_to Brightcontent.application_name, root_path, class: "navbar-brand" %>
12
+ </div>
13
+ <div class="navbar-collapse collapse">
14
+ <ul class="nav navbar-nav js-menu">
15
+ <%= render "menu" %>
16
+ </ul>
17
+ <ul class="nav navbar-nav navbar-right">
18
+ <li class="dropdown">
19
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">
20
+ <%= image_tag avatar_url(current_user), class: 'avatar' %>
21
+ <%= current_user.email %><b class="caret"></b>
22
+ </a>
23
+ <ul class="dropdown-menu">
24
+ <%= render "brightcontent/application/user_menu" %>
25
+ </ul>
26
+ </li>
27
+ </ul>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ <% end %>
@@ -10,43 +10,10 @@
10
10
  </head>
11
11
 
12
12
  <body data-editor-locale="<%=t('brightcontent.editor_locale')%>">
13
- <% if current_user %>
14
- <div class="navbar navbar-inverse navbar-bc navbar-static-top" role="navigation">
15
- <div class="container">
16
- <div class="navbar-header">
17
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
18
- <span class="sr-only">Toggle navigation</span>
19
- <span class="icon-bar"></span>
20
- <span class="icon-bar"></span>
21
- <span class="icon-bar"></span>
22
- </button>
23
- <%= link_to Brightcontent.application_name, root_path, class: "navbar-brand" %>
24
- </div>
25
- <div class="navbar-collapse collapse">
26
- <ul class="nav navbar-nav js-menu">
27
- <%= render "menu" %>
28
- </ul>
29
- <ul class="nav navbar-nav navbar-right">
30
- <li class="dropdown">
31
- <a href="#" class="dropdown-toggle" data-toggle="dropdown">
32
- <%= image_tag avatar_url(current_user), class: 'avatar' %>
33
- <%= current_user.email %><b class="caret"></b>
34
- </a>
35
- <ul class="dropdown-menu">
36
- <%= render "brightcontent/application/user_menu" %>
37
- </ul>
38
- </li>
39
- </ul>
40
- </div>
41
- </div>
42
- </div>
43
- <% end %>
13
+ <%= render 'layouts/brightcontent/navbar' %>
44
14
 
45
15
  <div class="container">
46
- <div class="<%= "panel panel-default" unless controller.controller_name == 'sessions' %>">
47
- <%= render "brightcontent/application/show_flash_names" %>
48
- <%= yield %>
49
- </div>
16
+ <%= render 'layouts/brightcontent/content' %>
50
17
  </div>
51
18
  </div>
52
19
 
@@ -0,0 +1,23 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= Brightcontent.application_name %></title>
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <meta name="robots" content="noindex" />
7
+ <%= stylesheet_link_tag "brightcontent/brightcontent", :media => "all" %>
8
+ <%= yield :head %>
9
+ <%= csrf_meta_tags %>
10
+ </head>
11
+
12
+ <body data-editor-locale="<%=t('brightcontent.editor_locale')%>">
13
+ <%= render 'layouts/brightcontent/navbar' %>
14
+
15
+ <div class="container-wide">
16
+ <%= render 'layouts/brightcontent/content' %>
17
+ </div>
18
+ </div>
19
+
20
+ <%= javascript_include_tag "brightcontent/brightcontent" %>
21
+ <%= yield :bottom %>
22
+ </body>
23
+ </html>
@@ -25,12 +25,12 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency "sass-rails", ">= 4.0.2"
26
26
  s.add_dependency "simple_form"
27
27
  s.add_dependency "will_paginate"
28
- s.add_dependency "will_paginate-bootstrap"
29
28
  s.add_dependency "ransack", ">= 1.1"
30
29
 
31
30
  s.add_development_dependency "rake"
32
31
  s.add_development_dependency "sqlite3"
33
- s.add_development_dependency "rspec", "~> 2.14.1"
32
+ s.add_development_dependency "rspec"
33
+ s.add_development_dependency "rspec-its"
34
34
  s.add_development_dependency "rspec-rails"
35
35
  s.add_development_dependency "capybara"
36
36
  s.add_development_dependency "launchy"
@@ -1,4 +1,4 @@
1
- class CreateBrightcontentAdminUsers < ActiveRecord::Migration
1
+ class CreateBrightcontentAdminUsers < ActiveRecord::Migration[4.2]
2
2
  def up
3
3
  create_table :brightcontent_admin_users do |t|
4
4
  t.string :email
@@ -11,7 +11,6 @@ require "ransack"
11
11
  require "jquery-rails"
12
12
  require "simple_form"
13
13
  require "will_paginate"
14
- require "will_paginate-bootstrap"
15
14
 
16
15
  require "brightcontent/rails/routes"
17
16
  require "brightcontent/engine"
@@ -24,6 +23,7 @@ module Brightcontent
24
23
  autoload :StrongParamsFix, 'brightcontent/strong_params_fix'
25
24
  autoload :ViewLookup, 'brightcontent/view_lookup'
26
25
  autoload :BaseControllerExt, 'brightcontent/base_controller_ext'
26
+ autoload :PaginationRenderer, 'brightcontent/pagination_renderer'
27
27
 
28
28
  mattr_accessor :locale
29
29
 
@@ -0,0 +1,64 @@
1
+ # Adapted from: https://github.com/bootstrap-ruby/will_paginate-bootstrap/blob/master/lib/bootstrap_pagination/bootstrap_renderer.rb
2
+ # Licensed under the MIT License, copyright (c) 2012 Nicholas Dainty
3
+ module Brightcontent
4
+ class PaginationRenderer < WillPaginate::ActionView::LinkRenderer
5
+ ELLIPSIS = "&hellip;"
6
+
7
+ def to_html
8
+ list_items = pagination.map do |item|
9
+ case item
10
+ when Integer
11
+ page_number(item)
12
+ else
13
+ send(item)
14
+ end
15
+ end.join(@options[:link_separator])
16
+
17
+ tag("ul", list_items, container_attributes.merge(class: ul_class))
18
+ end
19
+
20
+ def container_attributes
21
+ super.except(*[:link_options])
22
+ end
23
+
24
+ protected
25
+
26
+ def page_number(page)
27
+ link_options = @options[:link_options] || {}
28
+
29
+ if page == current_page
30
+ tag("li", tag("span", page), class: "active")
31
+ else
32
+ tag("li", link(page, page, link_options.merge(rel: rel_value(page))))
33
+ end
34
+ end
35
+
36
+ def previous_or_next_page(page, text, classname)
37
+ link_options = @options[:link_options] || {}
38
+
39
+ if page
40
+ tag("li", link(text, page, link_options), class: classname)
41
+ else
42
+ tag("li", tag("span", text), class: "%s disabled" % classname)
43
+ end
44
+ end
45
+
46
+ def gap
47
+ tag("li", tag("span", ELLIPSIS), class: "disabled")
48
+ end
49
+
50
+ def previous_page
51
+ num = @collection.current_page > 1 && @collection.current_page - 1
52
+ previous_or_next_page(num, @options[:previous_label], "prev")
53
+ end
54
+
55
+ def next_page
56
+ num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
57
+ previous_or_next_page(num, @options[:next_label], "next")
58
+ end
59
+
60
+ def ul_class
61
+ ["pagination", @options[:class]].compact.join(" ")
62
+ end
63
+ end
64
+ end
@@ -20,6 +20,7 @@ module Dummy
20
20
 
21
21
  # Activate observers that should always be running.
22
22
  # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
23
+ config.active_record.sqlite3&.represent_boolean_as_integer = true
23
24
 
24
25
  # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
25
26
  # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
@@ -47,7 +48,7 @@ module Dummy
47
48
  config.assets.enabled = true
48
49
 
49
50
  # config.i18n.enforce_available_locales = true
50
- config.active_record.raise_in_transactional_callbacks = true
51
+ # config.active_record.raise_in_transactional_callbacks = true
51
52
 
52
53
  # Version of your assets, change this if you want to expire all your assets
53
54
  config.assets.version = '1.0'
@@ -1,4 +1,4 @@
1
- class CreateBlogs < ActiveRecord::Migration
1
+ class CreateBlogs < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :blogs do |t|
4
4
  t.string :name
@@ -1,4 +1,4 @@
1
- class AddFeaturedToBlog < ActiveRecord::Migration
1
+ class AddFeaturedToBlog < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :blogs, :featured, :boolean
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateComments < ActiveRecord::Migration
1
+ class CreateComments < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :comments do |t|
4
4
  t.text :text
@@ -1,4 +1,4 @@
1
- class AddAuthorIdToBlogs < ActiveRecord::Migration
1
+ class AddAuthorIdToBlogs < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_reference :blogs, :author
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateAuthors < ActiveRecord::Migration
1
+ class CreateAuthors < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :authors do |t|
4
4
  t.string :name
@@ -1,4 +1,4 @@
1
- class AddActiveToBlogs < ActiveRecord::Migration
1
+ class AddActiveToBlogs < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :blogs, :active, :boolean, default: true
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateGroupedBlogs < ActiveRecord::Migration
1
+ class CreateGroupedBlogs < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :grouped_blogs do |t|
4
4
  t.string :name
@@ -0,0 +1,55 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 2016_06_23_142310) do
14
+
15
+ create_table "authors", force: :cascade do |t|
16
+ t.string "name"
17
+ t.datetime "created_at"
18
+ t.datetime "updated_at"
19
+ end
20
+
21
+ create_table "blogs", force: :cascade do |t|
22
+ t.string "name"
23
+ t.text "body"
24
+ t.datetime "created_at"
25
+ t.datetime "updated_at"
26
+ t.boolean "featured"
27
+ t.integer "author_id"
28
+ t.boolean "active", default: true
29
+ end
30
+
31
+ create_table "brightcontent_admin_users", force: :cascade do |t|
32
+ t.string "email"
33
+ t.string "password_digest"
34
+ t.datetime "created_at"
35
+ t.datetime "updated_at"
36
+ end
37
+
38
+ create_table "comments", force: :cascade do |t|
39
+ t.text "text"
40
+ t.integer "blog_id"
41
+ t.datetime "created_at"
42
+ t.datetime "updated_at"
43
+ t.index ["blog_id"], name: "index_comments_on_blog_id"
44
+ end
45
+
46
+ create_table "grouped_blogs", force: :cascade do |t|
47
+ t.string "name"
48
+ t.text "body"
49
+ t.boolean "active", default: true
50
+ t.integer "author_id"
51
+ t.datetime "created_at"
52
+ t.datetime "updated_at"
53
+ end
54
+
55
+ end
@@ -1,4 +1,5 @@
1
1
  require 'spec_helper'
2
+ include Brightcontent::TranslationHelper
2
3
 
3
4
  describe Brightcontent::TranslationHelper do
4
5
  let(:string) { "thing" }
@@ -24,7 +24,7 @@ module Brightcontent
24
24
  end
25
25
 
26
26
  it 'does have any exta menu items' do
27
- expect(resources.extra_menu?).to be_true
27
+ expect(resources.extra_menu?).to eq true
28
28
  end
29
29
  end
30
30
 
@@ -42,7 +42,7 @@ module Brightcontent
42
42
  end
43
43
 
44
44
  it 'does not have any exta menu items' do
45
- expect(resources.extra_menu?).to be_false
45
+ expect(resources.extra_menu?).to eq false
46
46
  end
47
47
  end
48
48
 
@@ -60,7 +60,7 @@ module Brightcontent
60
60
  end
61
61
 
62
62
  it 'does not have any exta menu items' do
63
- expect(resources.extra_menu?).to be_false
63
+ expect(resources.extra_menu?).to eq false
64
64
  end
65
65
  end
66
66
  end
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,7 @@ ENV["RAILS_ENV"] = "test"
2
2
  ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
3
3
 
4
4
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require 'rspec/its'
5
6
  require 'rspec/rails'
6
7
  require 'capybara/rspec'
7
8
  require 'factory_girl_rails'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightcontent-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.6
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Developers at Brightin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-10 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -151,35 +151,35 @@ dependencies:
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  - !ruby/object:Gem::Dependency
154
- name: will_paginate-bootstrap
154
+ name: ransack
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: '0'
159
+ version: '1.1'
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: '0'
166
+ version: '1.1'
167
167
  - !ruby/object:Gem::Dependency
168
- name: ransack
168
+ name: rake
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="
172
172
  - !ruby/object:Gem::Version
173
- version: '1.1'
174
- type: :runtime
173
+ version: '0'
174
+ type: :development
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
- version: '1.1'
180
+ version: '0'
181
181
  - !ruby/object:Gem::Dependency
182
- name: rake
182
+ name: sqlite3
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
185
  - - ">="
@@ -193,7 +193,7 @@ dependencies:
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  - !ruby/object:Gem::Dependency
196
- name: sqlite3
196
+ name: rspec
197
197
  requirement: !ruby/object:Gem::Requirement
198
198
  requirements:
199
199
  - - ">="
@@ -207,19 +207,19 @@ dependencies:
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  - !ruby/object:Gem::Dependency
210
- name: rspec
210
+ name: rspec-its
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - "~>"
213
+ - - ">="
214
214
  - !ruby/object:Gem::Version
215
- version: 2.14.1
215
+ version: '0'
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - "~>"
220
+ - - ">="
221
221
  - !ruby/object:Gem::Version
222
- version: 2.14.1
222
+ version: '0'
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: rspec-rails
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -324,7 +324,10 @@ files:
324
324
  - app/views/brightcontent/base/list_fields/_has_many.html.erb
325
325
  - app/views/brightcontent/base/new.html.erb
326
326
  - app/views/brightcontent/sessions/new.html.erb
327
+ - app/views/layouts/brightcontent/_content.html.erb
328
+ - app/views/layouts/brightcontent/_navbar.html.erb
327
329
  - app/views/layouts/brightcontent/application.html.erb
330
+ - app/views/layouts/brightcontent/wide.html.erb
328
331
  - bin/autospec
329
332
  - bin/rspec
330
333
  - brightcontent-core.gemspec
@@ -343,6 +346,7 @@ files:
343
346
  - lib/brightcontent/core.rb
344
347
  - lib/brightcontent/engine.rb
345
348
  - lib/brightcontent/model_extensions.rb
349
+ - lib/brightcontent/pagination_renderer.rb
346
350
  - lib/brightcontent/rails/routes.rb
347
351
  - lib/brightcontent/resource.rb
348
352
  - lib/brightcontent/resources.rb
@@ -402,6 +406,7 @@ files:
402
406
  - spec/dummy/db/migrate/20140512090832_create_authors.rb
403
407
  - spec/dummy/db/migrate/20150219130156_add_active_to_blogs.rb
404
408
  - spec/dummy/db/migrate/20160623142310_create_grouped_blogs.rb
409
+ - spec/dummy/db/schema.rb
405
410
  - spec/dummy/lib/assets/.gitkeep
406
411
  - spec/dummy/public/404.html
407
412
  - spec/dummy/public/422.html
@@ -445,7 +450,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
445
450
  version: '0'
446
451
  requirements: []
447
452
  rubyforge_project:
448
- rubygems_version: 2.6.6
453
+ rubygems_version: 2.7.6
449
454
  signing_key:
450
455
  specification_version: 4
451
456
  summary: Brightcontent core
@@ -495,6 +500,7 @@ test_files:
495
500
  - spec/dummy/db/migrate/20140512090832_create_authors.rb
496
501
  - spec/dummy/db/migrate/20150219130156_add_active_to_blogs.rb
497
502
  - spec/dummy/db/migrate/20160623142310_create_grouped_blogs.rb
503
+ - spec/dummy/db/schema.rb
498
504
  - spec/dummy/lib/assets/.gitkeep
499
505
  - spec/dummy/public/404.html
500
506
  - spec/dummy/public/422.html