polyblock 0.3.3 → 0.3.4

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: 27aeb630a9127e2fead39331c1bf6b2a3c0fc5d5
4
- data.tar.gz: c1c7040117197373034137d871eb1b128893ba8d
3
+ metadata.gz: 66e4cade17cdc3aee262380e99f8e62889d41968
4
+ data.tar.gz: 18f162bcbd919fdbb263d401120ae8118536821b
5
5
  SHA512:
6
- metadata.gz: c6c5c178a314336d52048d55b81a26f9e44ac8254663ef7a26fa324e105ebcf403d68ad0a601a309cc37514d167c95704083654276313de2a35465c7c1b78f74
7
- data.tar.gz: 6c459f102065a3cd910c2857889364449f5208cad89659da111dcb108cdb7fc5b9aa7f6109c0045e267af5994f1fa357bf44b298fcdb12eb67e00fa56296de51
6
+ metadata.gz: c9ff55efa794027c2d4e88c47b966dd75b4e481f59e87674adda84994e9d419152590a2ee69cad047c421ea0a0b40ca564339cb9a4ffe8a1b01da0883a7ec4ab
7
+ data.tar.gz: 0f2379b17229975e6e953ff4990156d9d0b679cb985621b954e598cce70512b583f6496af0899ed87ee2e231550531f43a9df213b73fefd0a050546e5a0b2ae4
@@ -32,12 +32,29 @@ module Polyblock
32
32
  # Build output tag
33
33
  content = pb_exists ? pb.content : "<p>This block is content managed by Polyblock!<br />Click to edit me!</p>"
34
34
  tag_options = options[:tag_options].deep_merge({:id => "pb-#{pb_id}", :data => {:pbid => pb_id, :pbname => name}})
35
- tag_options[:contenteditable] = (!respond_to?(:can?) || can?(:manage, pb)) ? "true" : "false"
35
+ tag_options[:contenteditable] = if options[:condensed]
36
+ "false"
37
+ elsif respond_to?(:can?) && can?(:manage, pb)
38
+ "true"
39
+ elsif respond_to?(:user_signed_in?) && user_signed_in?
40
+ if current_user.respond_to?(:admin?) && current_user.admin?
41
+ "true"
42
+ elsif pb.contentable.present? &&
43
+ pb.contentable.respond_to?(:user_id) &&
44
+ pb.contentable.user_id == current_user.id
45
+ "true"
46
+ else
47
+ "false"
48
+ end
49
+ else
50
+ "false"
51
+ end
36
52
  tag_options[:class] = (tag_options.has_key?(:class) ? "#{tag_options[:class]} ":"") + "polyblock"
37
53
  tag_options[:data][:pb_exists] = pb_exists
38
54
 
39
55
  # Truncation
40
56
  if options[:condensed]
57
+ tag_options[:class] += " polyblock-condensed"
41
58
  content = CGI.unescapeHTML(content.gsub("<br><br>", "<br>").gsub('&nbsp;', ' '))
42
59
  content = truncate(sanitize(strip_tags(content)), :length => options[:length], :omission => options[:omission]).html_safe
43
60
  end
@@ -1,3 +1,3 @@
1
1
  module Polyblock
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyblock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - MacKinley Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-21 00:00:00.000000000 Z
11
+ date: 2014-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails