tape-chr 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b500494d2aeb1397e10d8c9df54fb0d15246d087
4
+ data.tar.gz: c050375cf0b97bba42a7cb68fdb8c4f177b9ffb2
5
+ SHA512:
6
+ metadata.gz: df2cfe00851a7c11dbcad929076fc1118d88b55a3c6098d8ea7e632c2c5dea5992c7d5809b87d947a8644f3e48bc35e10b65204b56e99b1f47982ddf453fc9d9
7
+ data.tar.gz: 7bcd8fbafdb7623654d2417ac5117586c0df0b8951153c1ce8ebc3e72971f3dd6781fb12130c1cd9628e62c86516384bb0d103494a77a70828956f49486c3a20
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,228 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ tape-chr (0.1.8)
5
+ ants (>= 0.2.0)
6
+ chr (>= 0.4.0)
7
+ feedjira
8
+ mongosteen (>= 0.1.8)
9
+ nokogiri
10
+
11
+ GEM
12
+ remote: http://rubygems.org/
13
+ specs:
14
+ actionmailer (4.2.5)
15
+ actionpack (= 4.2.5)
16
+ actionview (= 4.2.5)
17
+ activejob (= 4.2.5)
18
+ mail (~> 2.5, >= 2.5.4)
19
+ rails-dom-testing (~> 1.0, >= 1.0.5)
20
+ actionpack (4.2.5)
21
+ actionview (= 4.2.5)
22
+ activesupport (= 4.2.5)
23
+ rack (~> 1.6)
24
+ rack-test (~> 0.6.2)
25
+ rails-dom-testing (~> 1.0, >= 1.0.5)
26
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
+ actionview (4.2.5)
28
+ activesupport (= 4.2.5)
29
+ builder (~> 3.1)
30
+ erubis (~> 2.7.0)
31
+ rails-dom-testing (~> 1.0, >= 1.0.5)
32
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
33
+ activejob (4.2.5)
34
+ activesupport (= 4.2.5)
35
+ globalid (>= 0.3.0)
36
+ activemodel (4.2.5)
37
+ activesupport (= 4.2.5)
38
+ builder (~> 3.1)
39
+ activerecord (4.2.5)
40
+ activemodel (= 4.2.5)
41
+ activesupport (= 4.2.5)
42
+ arel (~> 6.0)
43
+ activesupport (4.2.5)
44
+ i18n (~> 0.7)
45
+ json (~> 1.7, >= 1.7.7)
46
+ minitest (~> 5.1)
47
+ thread_safe (~> 0.3, >= 0.3.4)
48
+ tzinfo (~> 1.1)
49
+ ants (0.3.12)
50
+ devise
51
+ meta-tags
52
+ mongoid (>= 4.0)
53
+ mongoid-slug (>= 4.0.0)
54
+ arel (6.0.3)
55
+ bcrypt (3.1.10)
56
+ bourbon (4.2.6)
57
+ sass (~> 3.4)
58
+ thor (~> 0.19)
59
+ bson (4.0.0)
60
+ builder (3.2.2)
61
+ chr (0.5.6)
62
+ bourbon
63
+ coffee-rails (>= 4.0)
64
+ font-awesome-rails
65
+ formagic (>= 0.3.8)
66
+ jquery-rails
67
+ rails (~> 4.2.5)
68
+ sass-rails
69
+ coffee-rails (4.1.1)
70
+ coffee-script (>= 2.2.0)
71
+ railties (>= 4.0.0, < 5.1.x)
72
+ coffee-script (2.4.1)
73
+ coffee-script-source
74
+ execjs
75
+ coffee-script-source (1.10.0)
76
+ concurrent-ruby (1.0.0)
77
+ devise (3.5.3)
78
+ bcrypt (~> 3.0)
79
+ orm_adapter (~> 0.1)
80
+ railties (>= 3.2.6, < 5)
81
+ responders
82
+ thread_safe (~> 0.1)
83
+ warden (~> 1.2.3)
84
+ easy_diff (0.0.6)
85
+ erubis (2.7.0)
86
+ execjs (2.6.0)
87
+ faraday (0.9.2)
88
+ multipart-post (>= 1.2, < 3)
89
+ faraday_middleware (0.10.0)
90
+ faraday (>= 0.7.4, < 0.10)
91
+ fast-stemmer (1.0.2)
92
+ feedjira (2.0.0)
93
+ faraday (~> 0.9)
94
+ faraday_middleware (~> 0.9)
95
+ loofah (~> 2.0)
96
+ sax-machine (~> 1.0)
97
+ font-awesome-rails (4.5.0.0)
98
+ railties (>= 3.2, < 5.0)
99
+ formagic (0.3.8)
100
+ bourbon (>= 3.2)
101
+ normalize-rails (>= 3.0)
102
+ globalid (0.3.6)
103
+ activesupport (>= 4.1.0)
104
+ has_scope (0.6.0)
105
+ actionpack (>= 3.2, < 5)
106
+ activesupport (>= 3.2, < 5)
107
+ i18n (0.7.0)
108
+ inherited_resources (1.6.0)
109
+ actionpack (>= 3.2, < 5)
110
+ has_scope (~> 0.6.0.rc)
111
+ railties (>= 3.2, < 5)
112
+ responders
113
+ jquery-rails (4.0.5)
114
+ rails-dom-testing (~> 1.0)
115
+ railties (>= 4.2.0)
116
+ thor (>= 0.14, < 2.0)
117
+ json (1.8.3)
118
+ kaminari (0.16.3)
119
+ actionpack (>= 3.0.0)
120
+ activesupport (>= 3.0.0)
121
+ loofah (2.0.3)
122
+ nokogiri (>= 1.5.9)
123
+ mail (2.6.3)
124
+ mime-types (>= 1.16, < 3)
125
+ meta-tags (2.1.0)
126
+ actionpack (>= 3.0.0)
127
+ mime-types (2.99)
128
+ mini_portile2 (2.0.0)
129
+ minitest (5.8.3)
130
+ mongo (2.2.1)
131
+ bson (~> 4.0)
132
+ mongoid (5.0.1)
133
+ activemodel (~> 4.0)
134
+ mongo (~> 2.1)
135
+ origin (~> 2.1)
136
+ tzinfo (>= 0.3.37)
137
+ mongoid-compatibility (0.3.1)
138
+ activesupport
139
+ mongoid (>= 2.0)
140
+ mongoid-history (0.5.0)
141
+ activesupport
142
+ easy_diff
143
+ mongoid (>= 3.0)
144
+ mongoid-compatibility
145
+ mongoid-slug (5.1.1)
146
+ mongoid (>= 3.0)
147
+ mongoid-compatibility
148
+ stringex (~> 2.0)
149
+ mongoid_search (0.3.2)
150
+ fast-stemmer (~> 1.0.0)
151
+ mongoid (>= 3.0.0)
152
+ mongosteen (0.2.0)
153
+ has_scope (>= 0.6)
154
+ inherited_resources (>= 1.6)
155
+ kaminari (>= 0.16)
156
+ mongoid (>= 5.0)
157
+ mongoid-history (>= 0.5.0)
158
+ mongoid_search (>= 0.3)
159
+ multipart-post (2.0.0)
160
+ nokogiri (1.6.7.1)
161
+ mini_portile2 (~> 2.0.0.rc2)
162
+ normalize-rails (3.0.3)
163
+ origin (2.1.1)
164
+ orm_adapter (0.5.0)
165
+ rack (1.6.4)
166
+ rack-test (0.6.3)
167
+ rack (>= 1.0)
168
+ rails (4.2.5)
169
+ actionmailer (= 4.2.5)
170
+ actionpack (= 4.2.5)
171
+ actionview (= 4.2.5)
172
+ activejob (= 4.2.5)
173
+ activemodel (= 4.2.5)
174
+ activerecord (= 4.2.5)
175
+ activesupport (= 4.2.5)
176
+ bundler (>= 1.3.0, < 2.0)
177
+ railties (= 4.2.5)
178
+ sprockets-rails
179
+ rails-deprecated_sanitizer (1.0.3)
180
+ activesupport (>= 4.2.0.alpha)
181
+ rails-dom-testing (1.0.7)
182
+ activesupport (>= 4.2.0.beta, < 5.0)
183
+ nokogiri (~> 1.6.0)
184
+ rails-deprecated_sanitizer (>= 1.0.1)
185
+ rails-html-sanitizer (1.0.2)
186
+ loofah (~> 2.0)
187
+ railties (4.2.5)
188
+ actionpack (= 4.2.5)
189
+ activesupport (= 4.2.5)
190
+ rake (>= 0.8.7)
191
+ thor (>= 0.18.1, < 2.0)
192
+ rake (10.4.2)
193
+ responders (2.1.1)
194
+ railties (>= 4.2.0, < 5.1)
195
+ sass (3.4.20)
196
+ sass-rails (5.0.4)
197
+ railties (>= 4.0.0, < 5.0)
198
+ sass (~> 3.1)
199
+ sprockets (>= 2.8, < 4.0)
200
+ sprockets-rails (>= 2.0, < 4.0)
201
+ tilt (>= 1.1, < 3)
202
+ sax-machine (1.3.2)
203
+ sprockets (3.5.2)
204
+ concurrent-ruby (~> 1.0)
205
+ rack (> 1, < 3)
206
+ sprockets-rails (3.0.0)
207
+ actionpack (>= 4.0)
208
+ activesupport (>= 4.0)
209
+ sprockets (>= 3.0.0)
210
+ stringex (2.5.2)
211
+ thor (0.19.1)
212
+ thread_safe (0.3.5)
213
+ tilt (2.0.1)
214
+ tzinfo (1.2.2)
215
+ thread_safe (~> 0.1)
216
+ warden (1.2.4)
217
+ rack (>= 1.0)
218
+
219
+ PLATFORMS
220
+ ruby
221
+
222
+ DEPENDENCIES
223
+ bundler (~> 1.9)
224
+ rake (~> 10.0)
225
+ tape-chr!
226
+
227
+ BUNDLED WITH
228
+ 1.10.6
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2015 [Alexander Kravets](https://github.com/alexkravets)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # Tape
2
+
3
+ *RSS reader for [Character](https://github.com/slate-studio/chr) project.*
4
+
5
+
6
+ ### Installation
7
+
8
+ Add to ```Gemfile```:
9
+
10
+ gem 'tape', github: 'alexkravets/tape'
11
+
12
+ Add tape resource controllers to ```routes.rb```:
13
+
14
+ ```ruby
15
+ # rss
16
+ resources :tape_subscriptions, controller: 'tape_subscriptions'
17
+ resources :tape_posts, controller: 'tape_posts'
18
+ ```
19
+
20
+ Add to ```admin.scss``` and ```admin.coffee```:
21
+
22
+ ```scss
23
+ @import "tape";
24
+ ```
25
+
26
+ ```coffee
27
+ #= require tape
28
+ ```
29
+
30
+ Add to ```admin.coffee``` character configuration object:
31
+
32
+ ```coffee
33
+ tape: new Tape()
34
+ ```
35
+
36
+
37
+ ## Tape family
38
+
39
+ - [Character](https://github.com/slate-studio/chr): Powerful javascript CMS for apps
40
+ - [Mongosteen](https://github.com/slate-studio/mongosteen): An easy way to add restful actions for mongoid models
41
+ - [Inverter](https://github.com/slate-studio/inverter): An easy way to connect Rails templates content to CMS
42
+ - [Loft](https://github.com/slate-studio/loft): Media assets manager for Character CMS
43
+
44
+
45
+ ## License
46
+
47
+ Copyright © 2015 [Alexander Kravets](https://github.com/alexkravets). Loft is free software, and may be redistributed under the terms specified in the [license](LICENSE.md).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,31 @@
1
+ class @PostsHeader
2
+ constructor: (@list) ->
3
+ @_add_subscriptions()
4
+ @_add_refresh()
5
+
6
+
7
+ # PRIVATE ===============================================
8
+
9
+ _add_subscriptions: ->
10
+ @list.$subscriptions =$ """<a href='#/tape/subscriptions'
11
+ class='tape-header-subscriptions'>
12
+ <i class='fa fa-ellipsis-h'></i>
13
+ </a>"""
14
+ @list.$search.before(@list.$subscriptions)
15
+
16
+
17
+ _add_refresh: ->
18
+ @list.$refresh =$ """<a href='#' class='tape-refresh-posts'>
19
+ <i class='fa fa-refresh'></i>
20
+ </a>"""
21
+ @list.$refresh.on 'click', (e) =>
22
+ e.preventDefault()
23
+ @_refesh()
24
+
25
+ @list.$header.prepend(@list.$refresh)
26
+
27
+
28
+ _refesh: ->
29
+ @list.showSpinner()
30
+ $.get '/admin/tape_posts/new', =>
31
+ @list.updateItems()
@@ -0,0 +1,75 @@
1
+ class @TapePostsItem extends Item
2
+ constructor: (@module, @path, @object, @config) ->
3
+ @$el =$ """<a class='item tape-post' href='#{ @object.url }' data-id='#{ @object._id }' target='_blank'></a>"""
4
+ @render()
5
+
6
+
7
+ # PRIVATE ===============================================
8
+
9
+ _render_meta: (subscription_title, subscription_icon_url, published_at) ->
10
+ if ! @$meta
11
+ @$meta_subscription_title =$ "<span class='tape-post-subscription-title'>"
12
+ @$meta_subscription_icon =$ "<img class='tape-post-subscription-icon' src='' />"
13
+ @$meta_published_at =$ "<span class='tape-post-published-at'>"
14
+ @$meta =$ "<div class='tape-post-meta'>"
15
+ @$meta
16
+ .append(@$meta_subscription_icon)
17
+ .append(@$meta_subscription_title)
18
+ .append(@$meta_published_at)
19
+ @$el.append(@$meta)
20
+
21
+ @$meta_subscription_icon.attr 'src', subscription_icon_url
22
+ @$meta_subscription_title.html(subscription_title)
23
+ @$meta_published_at.html(published_at)
24
+
25
+ if subscription_icon_url == ''
26
+ @$meta_subscription_icon.hide()
27
+ else
28
+ @$meta_subscription_icon.show()
29
+
30
+
31
+ _render_image: (image_url) ->
32
+ if ! @$image
33
+ @$image =$ "<img class='tape-post-image'>"
34
+ @$el.append(@$image)
35
+
36
+ @$image.attr('src', image_url)
37
+
38
+
39
+ _render_title: (title) ->
40
+ if ! @$title
41
+ @$title =$ "<div class='tape-post-title'>"
42
+ @$el.append(@$title)
43
+
44
+ @$title.html(title)
45
+
46
+
47
+ _render_summary: (summary) ->
48
+ if summary == ''
49
+ @$summary?.remove()
50
+
51
+ else
52
+ if ! @$summary
53
+ @$summary =$ "<div class='tape-post-summary'>"
54
+ @$el.append(@$summary)
55
+
56
+ @$summary.html(summary)
57
+
58
+
59
+ # PUBLIC ================================================
60
+
61
+ render: ->
62
+ image_url = @object['_list_item_thumbnail'].plainText()
63
+ title = @object['_list_item_title'].plainText()
64
+ subscription_icon_url = @object['subscription_icon_url'].plainText()
65
+ subscription_title = @object['subscription_title'].plainText()
66
+ published_at = @object['_list_item_subtitle'].plainText()
67
+ summary = @object['summary'].plainText()
68
+
69
+ @_render_meta(subscription_title, subscription_icon_url, published_at)
70
+
71
+ # if image_url != ''
72
+ # @_render_image(image_url)
73
+
74
+ @_render_title(title)
75
+ @_render_summary(summary)
@@ -0,0 +1,105 @@
1
+ class @WebsiteView
2
+ constructor: (@view) ->
3
+ @object = @view.object
4
+
5
+ @_link_inputs()
6
+
7
+ if @object
8
+ @_disable_title()
9
+
10
+ else
11
+ @_initialize_form_new()
12
+
13
+
14
+ # PRIVATE ===============================================
15
+
16
+ _disable_title: ->
17
+ @$websiteUrlInput.$input.prop('disabled', true)
18
+ @$websiteUrlInput.$el.addClass('input-disabled')
19
+
20
+
21
+ _initialize_form_new: ->
22
+ @_add_next()
23
+ @_hide_save()
24
+ @_hide_optional_inputs()
25
+
26
+
27
+ _link_inputs: ->
28
+ @$websiteIconUrlInput = @view.form.inputs.website_icon_url
29
+ @$websiteUrlInput = @view.form.inputs.website_url
30
+ @$titleInput = @view.form.inputs.title
31
+ @$channelsInput = @view.form.inputs.channels
32
+
33
+
34
+ _add_next: ->
35
+ @$next =$ "<a href='#' class='tape-header-next'>Next</a>"
36
+ @$next.on 'click', (e) =>
37
+ @_fetch_new_subscription()
38
+ e.preventDefault()
39
+ @view.$header.append @$next
40
+
41
+
42
+ _hide_next: ->
43
+ @$next.hide()
44
+
45
+
46
+ _hide_save: ->
47
+ @view.$saveBtn.hide()
48
+
49
+
50
+ _hide_optional_inputs: ->
51
+ @$titleInput.$el.hide()
52
+ @$channelsInput.$el.hide()
53
+
54
+
55
+ _show_save: ->
56
+ @view.$saveBtn.show()
57
+
58
+
59
+ _fetch_new_subscription: ->
60
+ website_url = @$websiteUrlInput.$input.val()
61
+
62
+ if website_url == ''
63
+ @$websiteUrlInput.showErrorMessage("is required")
64
+
65
+ else
66
+ @view.showSpinner()
67
+ $.get '/admin/tape_subscriptions/new', { url: website_url }, (subscription) =>
68
+ @view.hideSpinner()
69
+
70
+ if ! subscription
71
+ @$websiteUrlInput.showErrorMessage("can't be reached")
72
+
73
+ else if ! subscription.channels
74
+ @$websiteUrlInput.showErrorMessage("doesn't have RSS channels")
75
+
76
+ else
77
+ @_update_optional_inputs(subscription)
78
+ @_show_optional_inputs()
79
+
80
+
81
+ _update_optional_inputs: (subscription) ->
82
+ @$websiteIconUrlInput.updateValue(subscription.website_icon_url)
83
+ @$websiteUrlInput.updateValue(subscription.website_url)
84
+ @$titleInput.updateValue(subscription.title)
85
+ @$channelsInput.updateValue(subscription.channels)
86
+
87
+ @_ignore_id_for_channel_documents()
88
+
89
+
90
+ _ignore_id_for_channel_documents: ->
91
+ for f in @$channelsInput.forms
92
+ f.inputs._id.config.ignoreOnSubmission = true
93
+
94
+
95
+ _show_optional_inputs: ->
96
+ @$websiteUrlInput.$el.hide()
97
+ @$titleInput.$el.show()
98
+ @$channelsInput.$el.show()
99
+
100
+ @_show_save()
101
+ @_hide_next()
102
+
103
+
104
+
105
+
@@ -0,0 +1,67 @@
1
+ #= require_tree ./tape
2
+
3
+ class @Tape
4
+ constructor: (title='RSS', apiPath='/admin') ->
5
+ config =
6
+ title: title
7
+ menuIcon: 'feed'
8
+
9
+ itemClass: TapePostsItem
10
+
11
+ onListInit: (list) ->
12
+ new PostsHeader(list)
13
+
14
+ onModuleInit: (module) ->
15
+ if module.chr.isDesktop()
16
+ module.chr.$mainMenu.find('.menu-tape').attr 'href', '#/tape/subscriptions'
17
+
18
+ arrayStore: new RailsArrayStore({
19
+ resource: 'tape_post'
20
+ path: "#{ apiPath }/tape_posts"
21
+ sortBy: 'published_at'
22
+ sortReverse: true
23
+ searchable: true
24
+ })
25
+
26
+ items:
27
+ subscriptions:
28
+ arrayStore: new RailsArrayStore({
29
+ resource: 'tape_subscription'
30
+ path: "#{ apiPath }/tape_subscriptions"
31
+ sortBy: 'title'
32
+ searchable: true
33
+ })
34
+
35
+ formSchema:
36
+ website_icon_url: { type: 'hidden' }
37
+
38
+ group_panel:
39
+ type: "group"
40
+ groupClass: "group-panel"
41
+ inputs:
42
+ title:
43
+ type: 'string'
44
+ placeholder: 'Subscription title'
45
+ required: true
46
+
47
+ channels:
48
+ type: 'documents'
49
+ formSchema:
50
+ title : { type: 'hidden' }
51
+ url : { type: 'hidden' }
52
+ active:
53
+ type: 'switch'
54
+ onInitialize: (input) ->
55
+ input.$label.html """<span class='tape-channel-title'>#{ input.object.title }</span><br />
56
+ <span class='tape-channel-url'>#{ input.object.url }</span>"""
57
+
58
+ website_url:
59
+ type: 'string'
60
+ placeholder: 'Website url'
61
+ label: 'Website'
62
+ required: true
63
+
64
+ onViewShow: (view) ->
65
+ new WebsiteView(view)
66
+
67
+ return config
@@ -0,0 +1,39 @@
1
+ .tape-post {
2
+ @include position(relative);
3
+ @include user-select(none);
4
+
5
+ padding : 1.5em 1em;
6
+
7
+ &:hover .tape-post-title {
8
+ color : $positive-color;
9
+ }
10
+ }
11
+
12
+ .tape-post-meta {
13
+ font-size : .8em;
14
+ color : lighten($base-font-color, 35%);
15
+ }
16
+
17
+ .tape-post-title {
18
+ font-weight : $medium;
19
+ margin-top : .25em;
20
+ color : rgb(64,64,64);
21
+ }
22
+
23
+ .tape-post-summary {
24
+ line-height : 1.3;
25
+ margin-top : .75em;
26
+ font-size : .8em;
27
+ color : lighten($base-font-color, 35%);
28
+ }
29
+
30
+ .tape-post-subscription-icon {
31
+ @include position(absolute, 2.75em null null -2.75em);
32
+ width : 2.5em;
33
+ }
34
+
35
+ .tape-post-published-at:before {
36
+ @include position(relative);
37
+ content : ' • ';
38
+ bottom : -1px;
39
+ }