sibu 0.5.6 → 0.6.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
2
  SHA1:
3
- metadata.gz: 0c7d523fedee01e7f41f6ea81a2dcb9d96df8d69
4
- data.tar.gz: 1ec96000ae16aaf420cfdecc5cc4a572c60b90c9
3
+ metadata.gz: 5c359dcb1bc4d7356ca37b607246afda7665c549
4
+ data.tar.gz: e9a586994f8b165d4642235aa3408b21e93c1b05
5
5
  SHA512:
6
- metadata.gz: ebf94090c127a16203bf3125f8a3587f1f7d895c431618472ebd0d58252b21421a411e244450d066720e4a19fd18f1b1f575fff9bb396ab1e10e8131a344b357
7
- data.tar.gz: c7b825f62ad04f5ed70f9ad91946567d6ae3f692e115cdded8078a5b2064e328a440a0d6b0f6bccde9bb496ad41ed5d93935fc53979ce6aef0fcfdbae3fbf87b
6
+ metadata.gz: 7d46a51a3509a60efd50c824f7447f1fd9bb1d2ffea7f94871100c1b3d0ad1b6b8993321d33b4544b3c9451be07ff7cf3d1922a829fb7adea90729f73d739db6
7
+ data.tar.gz: 6c9e093fc1b83ef300558d2e3a5766dc183553449ea15dd0efecbedb5d82e6c9d2e399286aeb6b1491563683d870824ea89f3197af2444778c91a88036ef2e28
@@ -3,7 +3,7 @@ require_dependency "sibu/application_controller"
3
3
  module Sibu
4
4
  class DocumentsController < ApplicationController
5
5
  def index
6
- @documents = Sibu::Document.shared + Sibu::Document.for_user(sibu_user)
6
+ @documents = Sibu::Document.for_user(sibu_user)
7
7
  end
8
8
 
9
9
  def new
@@ -6,7 +6,7 @@ module Sibu
6
6
  before_action :set_edition_context, only: [:new, :create]
7
7
 
8
8
  def index
9
- @images = Sibu::Image.shared + Sibu::Image.for_user(sibu_user)
9
+ @images = Sibu::Image.for_user(sibu_user)
10
10
  end
11
11
 
12
12
  def new
@@ -12,7 +12,7 @@ module Sibu
12
12
  end
13
13
 
14
14
  def site_images
15
- ([Sibu::Image.empty] + Sibu::Image.shared + Sibu::Image.for_user(sibu_user)).uniq
15
+ ([Sibu::Image.empty] + Sibu::Image.for_user(sibu_user)).uniq
16
16
  end
17
17
 
18
18
  def available_links
@@ -20,13 +20,13 @@ module Sibu
20
20
  end
21
21
 
22
22
  def available_docs
23
- options_from_collection_for_select((Sibu::Document.shared + Sibu::Document.for_user(sibu_user)), :file_url, :file_name, @element["value"])
23
+ options_from_collection_for_select(Sibu::Document.for_user(sibu_user), :file_url, :file_name, @element["value"])
24
24
  end
25
25
 
26
26
  def link_type(val)
27
27
  if val.blank? || val == '#' || /^\d+$/.match(val.to_s)
28
28
  'internal'
29
- elsif (Sibu::Document.shared + Sibu::Document.for_user(sibu_user)).map {|d| d.file_url}.include?(val)
29
+ elsif Sibu::Document.for_user(sibu_user).map {|d| d.file_url}.include?(val)
30
30
  'document'
31
31
  else
32
32
  'external'
@@ -3,7 +3,11 @@ module Sibu
3
3
  include ActiveSupport::Concern
4
4
 
5
5
  def for_user(usr)
6
- where(user_id: usr.id)
6
+ Rails.application.config.sibu[:multi_user] ? (shared + where(user_id: usr.id)) : all
7
+ end
8
+
9
+ def shared
10
+ where(user_id: nil)
7
11
  end
8
12
  end
9
13
  end
@@ -5,10 +5,6 @@ module Sibu
5
5
 
6
6
  validates_presence_of :file_data
7
7
 
8
- def self.shared
9
- where(user_id: nil)
10
- end
11
-
12
8
  def metadata
13
9
  JSON.parse(file_data, symbolize_names: true)[:metadata]
14
10
  end
@@ -7,10 +7,6 @@ module Sibu
7
7
 
8
8
  validates_presence_of :file_data
9
9
 
10
- def self.shared
11
- where(user_id: nil)
12
- end
13
-
14
10
  def self.empty
15
11
  empty_img = where("metadata ILIKE '%default_empty_image%'").first
16
12
  if empty_img.nil?
data/lib/sibu/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sibu
2
- VERSION = '0.5.6'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sibu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Baptiste Vilain