outpost-asset_host 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0b057234884be99db3aa56824d86d30feb805b5c
4
+ data.tar.gz: 698ef6151d5ad6a3cdf287b38c3d6277cdfc683c
5
+ SHA512:
6
+ metadata.gz: 0f8879c7a9e081de29e1706b0fecabc625c8fb4a6ee2ff627b3c8a29cf00bd8661d25edc6dd76eff746b1f1965ceb1191e79997e14428123d6d3be2977deda6e
7
+ data.tar.gz: dc1b6e608bf178f74bb4afa7c1b029501278608868bf1c8f2bee892333eca222bc148db963053c91c052935e9b68b870accdc4e440fe6d6db40c39bd49dbc1c2
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ ## 1.1.0
2
+ ### Changes
3
+ * Removed old Secretary hooks.
4
+ * Increased pop-up chooser height.
@@ -17,9 +17,9 @@ class outpost.AssetManager
17
17
 
18
18
  @assets = new outpost.AssetHost.Assets(assets)
19
19
  @assetsView = new outpost.AssetManager.Assets(collection: @assets)
20
-
20
+
21
21
  @el.html @assetsView.el
22
-
22
+
23
23
  # Register listener for AssetHost message
24
24
  window.addEventListener "message", (event) =>
25
25
  # If the data is an object (i.e. not "LOADED"), do things
@@ -31,18 +31,18 @@ class outpost.AssetManager
31
31
  , false
32
32
 
33
33
  #----------
34
-
34
+
35
35
  updateInput: ->
36
36
  $(@options.jsonInput).val(JSON.stringify(@assets.simpleJSON()))
37
-
37
+
38
38
  #----------
39
-
39
+
40
40
  @Asset: Backbone.View.extend
41
41
  tagName: "li"
42
42
  template: JST[AssetManager.TemplatePath + 'asset']
43
-
43
+
44
44
  #----------
45
-
45
+
46
46
  initialize: ->
47
47
  @render()
48
48
  @model.bind "change", => @render()
@@ -52,35 +52,35 @@ class outpost.AssetManager
52
52
  render: ->
53
53
  if @model.get('tags')
54
54
  @$el.html @template(asset: @model.toJSON())
55
-
55
+
56
56
  @
57
-
57
+
58
58
  #----------
59
59
 
60
60
  @Assets: Backbone.View.extend
61
61
  tagName: "ul"
62
62
  events: "click a.popup": "_popup"
63
-
63
+
64
64
  initialize: ->
65
65
  @_views = {}
66
-
67
- @collection.bind "reset", =>
66
+
67
+ @collection.bind "reset", =>
68
68
  view.detach() for view in @_views
69
69
  @_views = {}
70
-
71
- @collection.bind 'add', (f) =>
70
+
71
+ @collection.bind 'add', (f) =>
72
72
  @_views[f.cid] = new outpost.AssetManager.Asset
73
73
  model: f
74
-
74
+
75
75
  @renderCollection()
76
76
 
77
- @collection.bind 'remove', (f) =>
77
+ @collection.bind 'remove', (f) =>
78
78
  $(@_views[f.cid].el).detach()
79
79
  delete @_views[f.cid]
80
80
  @renderCollection()
81
-
81
+
82
82
  # attach a listener to wait for the LOADED message
83
- window.addEventListener "message", (evt) =>
83
+ window.addEventListener "message", (evt) =>
84
84
  if evt.data == "LOADED" and @chooserIsAvailable()
85
85
  console.log @collection.toJSON()
86
86
  # dispatch our event with the asset data
@@ -88,56 +88,56 @@ class outpost.AssetManager
88
88
  , false
89
89
 
90
90
  @render()
91
-
91
+
92
92
  #----------
93
93
 
94
94
  chooserIsAvailable: ->
95
95
  window.assethostChooser and !window.assethostChooser.closed
96
96
 
97
97
  #----------
98
-
98
+
99
99
  _popup: (event) ->
100
100
  event.originalEvent.stopPropagation()
101
101
  event.originalEvent.preventDefault()
102
-
102
+
103
103
  popup =
104
104
  url: "#{assethost.SERVER}/a/chooser"
105
105
  name: "chooser"
106
- options: "height=620,width=1000,scrollbars=1"
107
-
106
+ options: "height=1000,width=1000,scrollbars=1"
107
+
108
108
  if @chooserIsAvailable()
109
109
  window.assethostChooser.focus()
110
110
  else
111
111
  window.assethostChooser = window.open(popup.url, popup.name, popup.options)
112
-
112
+
113
113
  false
114
-
114
+
115
115
  #----------
116
116
  # Render the full view. This should only be called once.
117
117
  render: ->
118
118
  @$el.html JST[AssetManager.TemplatePath + 'asset_manager']
119
119
  @collectionEl = $(".collection", @$el)
120
120
  @emptyNotification = new outpost.Notification(
121
- @collectionEl,
122
- "info",
121
+ @collectionEl,
122
+ "info",
123
123
  "There are no assets. Click the button to open AssetHost."
124
124
  )
125
-
125
+
126
126
  @renderCollection()
127
127
  @
128
-
128
+
129
129
  #----------
130
130
  # Render the collection. This gets called every time AssetHost send a message.
131
131
  renderCollection: ->
132
132
  if @collection.isEmpty()
133
133
  return @emptyNotification.render()
134
-
134
+
135
135
  @collection.each (asset, index) =>
136
136
  asset.set(ORDER: index)
137
137
 
138
138
  @_views[asset.cid] ?= new outpost.AssetManager.Asset
139
139
  model: asset
140
-
140
+
141
141
  views = _(@_views).sortBy (a) => a.model.get("ORDER")
142
142
  @collectionEl.html( _(views).map (v) -> v.el )
143
143
  @
@@ -10,7 +10,7 @@ class outpost.AssetHost
10
10
  # simpleJSON is an object of just the attributes
11
11
  # we care about for SCPRv4. Everything else is
12
12
  # pulled from the AssetHost API.
13
- #
13
+ #
14
14
  # This should be kept in sync with ContentAsset#simple_json
15
15
  simpleJSON: ->
16
16
  {
@@ -18,28 +18,28 @@ class outpost.AssetHost
18
18
  caption: @get 'caption'
19
19
  position: @get 'ORDER'
20
20
  }
21
-
21
+
22
22
  #--------------
23
-
23
+
24
24
  url: ->
25
25
  url = if @isNew() then @urlRoot else @urlRoot + encodeURIComponent(@id)
26
-
26
+
27
27
  if assethost.TOKEN
28
28
  token = $.param(auth_token:assethost.TOKEN)
29
29
  url += "?#{token}"
30
-
30
+
31
31
  url
32
-
32
+
33
33
  #----------
34
34
 
35
35
  @Assets: Backbone.Collection.extend
36
36
  model: @Asset
37
-
37
+
38
38
  # If we have an ORDER attribute, sort by that.
39
39
  # Otherwise, sort by just the asset ID.
40
40
  comparator: (asset) ->
41
41
  asset.get("ORDER") || -Number(asset.get("id"))
42
-
42
+
43
43
  #----------
44
44
  # An array of assets turned into simpleJSON. See
45
45
  # Asset#simpleJSON for more.
@@ -47,5 +47,5 @@ class outpost.AssetHost
47
47
  assets = []
48
48
  @each (asset) -> assets.push(asset.simpleJSON())
49
49
  assets
50
-
50
+
51
51
  #----------
@@ -1,6 +1,6 @@
1
1
  <div class="thumbnail">
2
2
  <%- @asset.tags.lsquare %>
3
-
3
+
4
4
  <div class="asset-info">
5
5
  <h6><%= @asset.title %></h6>
6
6
  <small class="muted"><%= @asset.caption %></small>
@@ -1,14 +1,14 @@
1
1
  #asset_bucket {
2
2
  ul, li { @extend .unstyled; }
3
3
 
4
- li {
4
+ li {
5
5
  @extend .span4;
6
6
  margin: 0 5px 5px 0;
7
7
  float: left;
8
8
  height: 165px;
9
9
  overflow: hidden;
10
10
  }
11
-
11
+
12
12
  .thumbnail {
13
13
  border: 1px solid $grayLighter;
14
14
  padding: 5px;
@@ -19,12 +19,12 @@
19
19
  max-width: 150px;
20
20
  margin-right: 5px;
21
21
  }
22
-
22
+
23
23
  .asset-info {
24
- line-height: 12px;
25
- h6 {
26
- display: inline;
27
- line-height: 11px;
24
+ line-height: 12px;
25
+ h6 {
26
+ display: inline;
27
+ line-height: 11px;
28
28
  }
29
29
  }
30
30
  }
@@ -19,7 +19,7 @@ module Outpost
19
19
  #-------------------
20
20
  # #asset_json is a way to pass in a string representation
21
21
  # of a javascript object to the model, which will then be
22
- # parsed and turned into ContentAsset objects in the
22
+ # parsed and turned into ContentAsset objects in the
23
23
  # #asset_json= method.
24
24
  def asset_json
25
25
  current_assets_json.to_json
@@ -27,9 +27,9 @@ module Outpost
27
27
 
28
28
  #-------------------
29
29
  # Parse the input from #asset_json and turn it into real
30
- # ContentAsset objects.
30
+ # ContentAsset objects.
31
31
  def asset_json=(json)
32
- # If this is literally an empty string (as opposed to an
32
+ # If this is literally an empty string (as opposed to an
33
33
  # empty JSON object, which is what it would be if there were no assets),
34
34
  # then we can assume something went wrong and just abort.
35
35
  # This shouldn't happen since we're populating the field in the template.
@@ -37,26 +37,21 @@ module Outpost
37
37
 
38
38
  json = Array(JSON.parse(json)).sort_by { |c| c["position"].to_i }
39
39
  loaded_assets = []
40
-
40
+
41
41
  json.each do |asset_hash|
42
42
  new_asset = self.class.assets_association_join_class.constantize.new(
43
- :asset_id => asset_hash["id"].to_i,
44
- :caption => asset_hash["caption"].to_s,
43
+ :asset_id => asset_hash["id"].to_i,
44
+ :caption => asset_hash["caption"].to_s,
45
45
  :position => asset_hash["position"].to_i
46
46
  )
47
-
47
+
48
48
  loaded_assets.push new_asset
49
49
  end
50
-
50
+
51
51
  loaded_assets_json = assets_to_simple_json(loaded_assets)
52
52
 
53
- # If the assets didn't change, there's no need to bother the database.
53
+ # If the assets didn't change, there's no need to bother the database.
54
54
  if current_assets_json != loaded_assets_json
55
- if self.respond_to?(:custom_changes)
56
- self.custom_changes['assets'] = [current_assets_json, loaded_assets_json]
57
- end
58
-
59
- self.changed_attributes['assets'] = current_assets_json
60
55
  self.assets = loaded_assets
61
56
  end
62
57
 
@@ -1,5 +1,5 @@
1
1
  module Outpost
2
2
  module AssetHost
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outpost-asset_host
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bryan Ricker
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-12 00:00:00.000000000 Z
11
+ date: 2013-11-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,49 +27,43 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec-rails
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: combustion
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  description: AssetHost integration with Outpost.
@@ -83,6 +74,7 @@ extensions: []
83
74
  extra_rdoc_files: []
84
75
  files:
85
76
  - .gitignore
77
+ - CHANGELOG.md
86
78
  - Gemfile
87
79
  - MIT-LICENSE
88
80
  - README.md
@@ -101,27 +93,26 @@ files:
101
93
  homepage: https://github.com/SCPR/outpost-asset_host
102
94
  licenses:
103
95
  - MIT
96
+ metadata: {}
104
97
  post_install_message:
105
98
  rdoc_options: []
106
99
  require_paths:
107
100
  - lib
108
101
  required_ruby_version: !ruby/object:Gem::Requirement
109
- none: false
110
102
  requirements:
111
- - - ! '>='
103
+ - - '>='
112
104
  - !ruby/object:Gem::Version
113
105
  version: '0'
114
106
  required_rubygems_version: !ruby/object:Gem::Requirement
115
- none: false
116
107
  requirements:
117
- - - ! '>='
108
+ - - '>='
118
109
  - !ruby/object:Gem::Version
119
110
  version: '0'
120
111
  requirements: []
121
112
  rubyforge_project:
122
- rubygems_version: 1.8.25
113
+ rubygems_version: 2.0.3
123
114
  signing_key:
124
- specification_version: 3
115
+ specification_version: 4
125
116
  summary: Provides client-side hooks into AssetHost for Outpost.
126
117
  test_files: []
127
118
  has_rdoc: