Skip to content

Commit

Permalink
Merge d488452 into a9948ca
Browse files Browse the repository at this point in the history
  • Loading branch information
miks committed Dec 7, 2018
2 parents a9948ca + d488452 commit c961ddd
Show file tree
Hide file tree
Showing 44 changed files with 110 additions and 97 deletions.
4 changes: 2 additions & 2 deletions lib/releaf/rspec/helpers.rb
Expand Up @@ -54,7 +54,7 @@ def update_resource
end

def create_resource
click_link "Create new resource" unless first("form.new-resource")
click_link "Create new resource" unless first("form.new-resource", minimum: 0)
within "form.new-resource" do
yield
end
Expand Down Expand Up @@ -208,7 +208,7 @@ def fill_in_richtext(locator, options = {} )
textareas = []
richtext_boxes = all(".field.type-richtext:not(.i18n), .field.type-richtext.i18n .localization.active")
richtext_boxes.each do |richtext_box|
textarea = richtext_box.first(:field, locator, visible: false)
textarea = richtext_box.first(:field, locator, visible: false, minimum: 0)
textareas << textarea if textarea.present?
end

Expand Down
Expand Up @@ -10,7 +10,7 @@ def generate_url
tmp_resource.name = params[:name]
tmp_resource.reasign_slug

render text: tmp_resource.slug
render plain: tmp_resource.slug
end

def content_type_dialog
Expand Down
1 change: 0 additions & 1 deletion releaf-content/lib/releaf/content/route.rb
Expand Up @@ -57,7 +57,6 @@ def name( route_options )
# @return [Array] array of Content::Route objects
def self.for(node_class, node_content_class, default_controller)
node_class = node_class.constantize if node_class.is_a? String

Releaf::Content::BuildRouteObjects.call(
node_class: node_class,
node_content_class: node_content_class,
Expand Down
2 changes: 1 addition & 1 deletion releaf-content/releaf-content.gemspec
Expand Up @@ -17,5 +17,5 @@ Gem::Specification.new do |s|
s.add_dependency 'releaf-core', Releaf::VERSION
s.add_dependency 'stringex', '~> 2.6'
s.add_dependency 'awesome_nested_set', '~> 3.1'
s.add_dependency 'deep_cloneable', '~> 2.2.2'
s.add_dependency 'deep_cloneable', '~> 2.3.0'
end
Expand Up @@ -12,8 +12,8 @@ jQuery(function(){
var settings = key_or_settings;
if (typeof settings === "string")
{
settings = {};
settings[key_or_settings] = value;
settings = [];
settings.push({key: key_or_settings, value: value});
}

LiteAjax.ajax({ url: settings_path, method: 'POST', data: { "settings": settings}, json: true })
Expand Down
16 changes: 9 additions & 7 deletions releaf-core/app/controllers/releaf/root_controller.rb
Expand Up @@ -13,15 +13,17 @@ def features

# Store settings for menu collapsing and others
def store_settings
if params[:settings].is_a? Hash
params[:settings].each_pair do|key, value|
value = false if value == "false"
value = true if value == "true"
Releaf.application.config.settings_manager.write(controller: self, key: key, value: value)
settings = params.permit(settings: [:key, :value]).to_h.fetch(:settings, nil)
if settings
settings.each do|item|
next if item[:key].nil? || item[:value].nil?
item[:value] = true if item[:value] == "true"
item[:value] = false if item[:value] == "false"
Releaf.application.config.settings_manager.write(controller: self, key: item[:key], value: item[:value])
end
render nothing: true, status: 200
head :ok
else
render nothing: true, status: 422
head :unprocessable_entity
end
end
end
6 changes: 2 additions & 4 deletions releaf-core/app/lib/releaf/search.rb
Expand Up @@ -74,7 +74,7 @@ def join_reflection_without_through(reflection, table)

join_condition = case reflection.macro
when :has_many
self.relation = relation.uniq
self.relation = relation.distinct
table1[primary_key].eq(table2[foreign_key])
when :has_one
table1[primary_key].eq(table2[foreign_key])
Expand Down Expand Up @@ -107,9 +107,7 @@ def extract_where_condtion_from_scope(reflection, table_alias)
# XXX Hack based on ActiveRecord::Relation#to_sql
tmp_relation = build_tmp_relation(reflection, table_alias)

where_scope = tmp_relation.where_values

return nil if where_scope.blank?
return nil if tmp_relation.where_values_hash.blank?

connection = tmp_relation.klass.connection
visitor = connection.visitor
Expand Down
@@ -1,4 +1,4 @@
class CreateAuthors < ActiveRecord::Migration
class CreateAuthors < ActiveRecord::Migration[5.0]
def change
create_table :authors do |t|
t.string :name, :null => false
Expand Down
@@ -1,4 +1,4 @@
class CreateBannerGroups < ActiveRecord::Migration
class CreateBannerGroups < ActiveRecord::Migration[5.0]
def change
create_table :banner_groups do |t|
t.integer :banner_page_id
Expand Down
@@ -1,9 +1,9 @@
class CreateBannerPages < ActiveRecord::Migration
class CreateBannerPages < ActiveRecord::Migration[5.0]
def change
create_table :banner_pages do |t|
t.text :intro_text_html
t.string :top_banner_uid
t.string :bottom_banner_uid
t.string :bottom_banner_uid

t.timestamps(null: false)
end
Expand Down
@@ -1,8 +1,8 @@
class CreateBanners < ActiveRecord::Migration
class CreateBanners < ActiveRecord::Migration[5.0]
def change
create_table :banners do |t|
t.integer :banner_group_id
t.integer :item_position
t.integer :item_position
t.string :image_uid
t.string :url
t.timestamps(null: false)
Expand Down
@@ -1,4 +1,4 @@
class CreateBookSequels < ActiveRecord::Migration
class CreateBookSequels < ActiveRecord::Migration[5.0]
def up
create_table :book_sequels do |t|
t.integer :book_id, null: false
Expand Down
@@ -1,4 +1,4 @@
class CreateBooks < ActiveRecord::Migration
class CreateBooks < ActiveRecord::Migration[5.0]
def up
create_table :books do |t|
t.string :title, null: false
Expand Down
@@ -1,4 +1,4 @@
class CreateBundles < ActiveRecord::Migration
class CreateBundles < ActiveRecord::Migration[5.0]
def change
create_table :bundles do |t|
t.timestamps(null: false)
Expand Down
@@ -1,4 +1,4 @@
class CreateChapters < ActiveRecord::Migration
class CreateChapters < ActiveRecord::Migration[5.0]
def change
create_table :chapters do |t|
t.string :title, :null => false
Expand Down
@@ -1,4 +1,4 @@
class CreateHomePages < ActiveRecord::Migration
class CreateHomePages < ActiveRecord::Migration[5.0]
def change
create_table :home_pages do |t|
t.text :intro_text_html
Expand Down
@@ -1,4 +1,4 @@
class CreateNodeExtraFields < ActiveRecord::Migration
class CreateNodeExtraFields < ActiveRecord::Migration[5.0]
def change
add_column :nodes, :description, :text
end
Expand Down
@@ -1,4 +1,4 @@
class CreateOtherNodes < ActiveRecord::Migration
class CreateOtherNodes < ActiveRecord::Migration[5.0]
def change
create_table "other_nodes", :force => true do |t|
t.string "name"
Expand Down
@@ -1,4 +1,4 @@
class CreatePublishers < ActiveRecord::Migration
class CreatePublishers < ActiveRecord::Migration[5.0]
def change
create_table :publishers do |t|
t.string :title, :null => false
Expand Down
@@ -1,4 +1,4 @@
class CreateTextPages < ActiveRecord::Migration
class CreateTextPages < ActiveRecord::Migration[5.0]
def change
create_table :text_pages do |t|
t.text :text_html
Expand Down
@@ -1,4 +1,4 @@
class CreateReleafNodes < ActiveRecord::Migration
class CreateReleafNodes < ActiveRecord::Migration[5.0]
def change
create_table "nodes", :force => true do |t|
t.string "name"
Expand Down
@@ -1,4 +1,4 @@
class CreateReleafPermissions < ActiveRecord::Migration
class CreateReleafPermissions < ActiveRecord::Migration[5.0]
def change
create_table :releaf_permissions do |t|
t.integer :owner_id
Expand Down
@@ -1,4 +1,4 @@
class CreateReleafRichtextAttachments < ActiveRecord::Migration
class CreateReleafRichtextAttachments < ActiveRecord::Migration[5.0]
def change
create_table :releaf_richtext_attachments do |t|
t.string :file_uid
Expand Down
@@ -1,4 +1,4 @@
class CreateReleafRoles < ActiveRecord::Migration
class CreateReleafRoles < ActiveRecord::Migration[5.0]
def change
create_table :releaf_roles do |t|
t.string :name, :null => false
Expand Down
@@ -1,4 +1,4 @@
class CreateReleafSettings < ActiveRecord::Migration
class CreateReleafSettings < ActiveRecord::Migration[5.0]
def self.up
create_table :settings do |t|
t.string :var, :null => false
Expand Down
@@ -1,4 +1,4 @@
class CreateReleafTranslations < ActiveRecord::Migration
class CreateReleafTranslations < ActiveRecord::Migration[5.0]
def change
create_table :releaf_i18n_entries do |t|
t.string :key, null: false
Expand Down
@@ -1,4 +1,4 @@
class CreateReleafUsers < ActiveRecord::Migration
class CreateReleafUsers < ActiveRecord::Migration[5.0]
def change
create_table :releaf_users do |t|
t.string :name, :null => false
Expand Down
11 changes: 7 additions & 4 deletions releaf-core/releaf-core.gemspec
Expand Up @@ -14,22 +14,25 @@ Gem::Specification.new do |s|
s.files = Dir["app/**/*"] + Dir["lib/**/*"] + ["LICENSE"]
s.test_files = Dir["spec/**/*"]

s.add_dependency 'rails', '~> 4.2'
s.add_dependency 'i18n', '~> 0.7'
s.add_dependency 'rails', '~> 5.0.5'
s.add_dependency 'activesupport', '~> 5.0.5'
s.add_dependency 'activerecord', '~> 5.0.5'
s.add_dependency 'i18n', '~> 0.8.6'
s.add_dependency 'sprockets-rails', '~> 3.0'
s.add_dependency 'sass-rails', '~> 5.0'
s.add_dependency 'jquery-rails', '~> 4.2'
s.add_dependency 'jquery-ui-rails', '~> 5.0'
s.add_dependency 'vanilla-ujs', '~> 1.2'
s.add_dependency 'railties', '~> 4.2'
s.add_dependency 'railties', '~> 5.0.5'
s.add_dependency 'haml-rails', '~> 0.9'
s.add_dependency 'dragonfly', '~> 1.0'
s.add_dependency 'rails-settings-cached', '~> 0.4'
s.add_dependency 'ckeditor_rails', '~> 4.5'
s.add_dependency 'acts_as_list', '~> 0.8'
s.add_dependency 'will_paginate', '~> 3.1'
s.add_dependency 'font-awesome-rails', '~> 4.6'
s.add_dependency 'globalize-accessors', '~> 0.2'
s.add_dependency 'globalize', '5.1.0.beta2'
s.add_dependency 'globalize-accessors', '~> 0.2.1'
s.add_dependency 'rack-cache', '~> 1.0'
s.add_dependency 'virtus', '~> 1.0'
end
Expand Up @@ -9,7 +9,7 @@ class TranslationsEditBuilderTestHelper < ActionView::Base
def protect_against_forgery?
true
end
def form_authenticity_token
def form_authenticity_token(_)
"xxx"
end

Expand Down
Expand Up @@ -10,14 +10,14 @@

context "when file is uploaded" do
it "renders 'create_releaf_richtext_attachment'" do
post :create_releaf_richtext_attachment, upload: file
post :create_releaf_richtext_attachment, params: {upload: file}
expect( response ).to be_successful
expect( response ).to render_template('create_releaf_richtext_attachment')
end

it "creates attachment" do
expect do
post :create_releaf_richtext_attachment, upload: file
post :create_releaf_richtext_attachment, params: {upload: file}
end.to change { Releaf::RichtextAttachment.count }.by(1)
end
end
Expand Down

0 comments on commit c961ddd

Please sign in to comment.