rdcms_tour 0.0.1

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: f36c06633d8ff5d33d5e034e64ee002a488a089b
4
+ data.tar.gz: ca858a9d2dbb4d175047388144c109de8ca91de9
5
+ SHA512:
6
+ metadata.gz: 25d52bcc0af5af448b5ed0ff5fd97576739c9d9a1f6c6a502c92ce9b144bda4062fce384f12f76645197f2bf087bce344e7ba2ac66c85893c45fd5dc134aacdb
7
+ data.tar.gz: 3a5c3a862f24ad3351fac1fff29742c757ccb8888190b9f852d1d9a522d7c3cf4cf51d5c525377dd13663ad0ad3a655fca63cdf73fdc42e7968bc317539cab8f
data/.gitignore ADDED
@@ -0,0 +1,20 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+
19
+ # RubyMine IDE
20
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Gullit Miranda
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Rdcms Tours
2
+
3
+ O Rdcms Tour é o módulo para paranoramas, onde é possivel ter uma visão panorâmica (até 360 graus) de ambientes fazendo a marcação de itens de destaque.
4
+
5
+ ## Instalação
6
+
7
+ Adicione esta linha ao Gemfile da sua aplicação e efetue a instalação:
8
+
9
+ # Gemfile
10
+ gem "rdcms_tour"
11
+
12
+ # $
13
+ bundle install
14
+
15
+ ou instale-a diretamente execultando:
16
+
17
+ # $
18
+ gem install rdcms_tour
19
+
20
+
21
+ instale as migrações:
22
+
23
+ # $
24
+ bundle exec rake rdcms_tour:install
25
+ bundle exec rake db:migrate
26
+
27
+ ## Como utilizar
28
+
29
+ Adicione a linha ao load_paths do active_admin:
30
+
31
+ # config/initializers/active_admin.rb
32
+ config.load_paths << "#{RdcmsTour::Engine.root}/admin/"
33
+
34
+ ## Author
35
+ Gullit Miranda - [https://github.com/gullitmiranda](https://github.com/gullitmiranda)
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require "bundler/gem_tasks"
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = "Rdcms Tours #{RdcmsTour::VERSION}"
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.md')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
data/admin/tours.rb ADDED
@@ -0,0 +1,58 @@
1
+ ActiveAdmin.register Tour do
2
+ menu priority: 6,
3
+ parent: I18n.t('activerecord.models.content_management'),
4
+ if: proc{can?(:update, Tour)}
5
+ # menu false
6
+
7
+ index do
8
+ selectable_column
9
+
10
+ column :id
11
+ column :name, :sortable => :name do |p|
12
+ title = p.name if p.name.to_s.length < 40
13
+ link_to(truncate(p.name, :length => 40), [:admin, p], title: "#{title || ""}" )
14
+ end
15
+ column :body, :sortable => :body do |p|
16
+ text = strip_tags(p.body).to_s.strip
17
+ content_tag(:span, truncate(text, :length => 40), title: text )
18
+ end
19
+ column :tag_list, :sortable => :tag_list do |p|
20
+ best_in_place p, :tag_list, type: :input, path: [:admin, p]
21
+ end
22
+
23
+ # Options
24
+ column :speed, :sortable => :speed do |p|
25
+ best_in_place p, :speed, type: :input, :nil => "0", path: [:admin, p]
26
+ end
27
+ column :direction, :sortable => :direction do |p|
28
+ best_in_place p, :direction, type: :select, path: [:admin, p],
29
+ :collection => [["right" , I18n.t(".right" ) ], ["left" , I18n.t(".left" ) ]]
30
+ # ["top" , I18n.t(".top" ) ], ["bottom" , I18n.t(".bottom") ],
31
+ end
32
+ column :control_display, :sortable => :control_display do |p|
33
+ best_in_place p, :control_display, type: :checkbox, path: [:admin, p]
34
+ end
35
+ column :start_position, :sortable => :start_position do |p|
36
+ best_in_place p, :start_position, type: :input, path: [:admin, p]
37
+ end
38
+ column :auto_start, :sortable => :auto_start do |p|
39
+ best_in_place p, :auto_start, type: :checkbox, path: [:admin, p]
40
+ end
41
+ column :loop, :sortable => :loop do |p|
42
+ best_in_place p, :loop, type: :checkbox, path: [:admin, p]
43
+ end
44
+
45
+ column :published, :sortable => :published do |p|
46
+ best_in_place p, :published, type: :checkbox, path: [:admin, p]
47
+ end
48
+ end
49
+
50
+ show do
51
+ render :partial => "show", locals: { :s => tour }
52
+ end
53
+
54
+ form :partial => "form"
55
+
56
+ batch_action :destroy, false
57
+ config.clear_sidebar_sections!
58
+ end
@@ -0,0 +1,264 @@
1
+ jQuery ->
2
+ Tour_labels = window.Tour_labels ? ""
3
+
4
+ $.fn.tour = (options) ->
5
+ _id = 0
6
+ _element = $()
7
+ _viewPort = $()
8
+ _panorama = $()
9
+ _navBar = $()
10
+ # Traduções
11
+ labels = $.extend
12
+ index: "Índice"
13
+ rotate_left: "Rotacionar para esquerda"
14
+ rotate_right: "Rotacionar para direita"
15
+ play_stop: "Reproduzir/Parar"
16
+ zoom: "Ampliar/Reduzir"
17
+ , Tour_labels
18
+
19
+ # Configurações
20
+ _settings = $.extend
21
+ viewport_width: 'auto'
22
+ speed: 20000
23
+ direction: "left"
24
+ control_display: "auto"
25
+ start_position: 0
26
+ auto_start: false
27
+ mode_360: true
28
+
29
+ # Container dos botões da navegação
30
+ navBarContainer: ".navbar:first > .navbar-inner > .container"
31
+
32
+ # Placemment dos tooltips
33
+ data_placement: "bottom"
34
+ , options
35
+
36
+ tour_animate = ->
37
+ unless _panorama.length
38
+ console.error "Não tem como animar um panorama que não existe :( !"
39
+ return false
40
+
41
+ currentPosition = 0 - parseInt(_panorama.css("margin-left"))
42
+
43
+ if _settings.direction is "right"
44
+ _panorama.animate marginLeft: 0 , ((_settings.speed / _settings.imageSizes.clientWidth) * (currentPosition)), "linear", ->
45
+ if _settings.mode_360
46
+ _panorama.css "marginLeft", "-#{parseInt(_settings.imageSizes.clientWidth)}px"
47
+ tour_animate()
48
+ else
49
+ rightlimit = if _settings.mode_360 then _settings.imageSizes.clientWidth else (_settings.imageSizes.clientWidth - _settings.viewport_width)
50
+
51
+ _panorama.animate
52
+ marginLeft: -rightlimit
53
+ , ((_settings.speed / rightlimit) * (rightlimit - currentPosition)), "linear", ->
54
+ if _settings.mode_360
55
+ _panorama.css "margin-left", 0
56
+ tour_animate()
57
+
58
+ tour_toggle_stop = (element, action) ->
59
+ $el = $(element).stop()
60
+ $btn = $el.parent().find('.rtPlayBtn, .rtPauseBtn')
61
+
62
+ if action is 'start'
63
+ $btn.removeClass('rtPlayBtn').addClass('rtPauseBtn')
64
+ tour_animate()
65
+ $el.data('started', true)
66
+ else
67
+ $btn.removeClass('rtPauseBtn').addClass('rtPlayBtn')
68
+ $el.data('started', false)
69
+
70
+ _createNavBar= () ->
71
+
72
+ _navBar = $(".BtnNavContainer", _settings.navBarContainer)
73
+ _navBar = $("""<div class="BtnNavContainer"></div>""").appendTo(_settings.navBarContainer) unless _navBar.length
74
+
75
+ navControllers = """
76
+ <div class="dropdown fade dpIndex">
77
+ <a class="BigButton btnIndex dropdown-toggle" data-toggle="dropdown" href="#" rel="tooltip" title="#{labels.index}" data-placement="#{_settings.data_placement}" ><span class="icon-list-4" aria-hidden="true"></span></a>
78
+ </div>
79
+
80
+ <div class="BigButton fade btnZoom" rel="tooltip" title="#{labels.zoom}" data-placement="#{_settings.data_placement}" ><span class="icon-zoom-in" aria-hidden="true"></span></div>
81
+
82
+ <div class="barControls fade zoomedControllers">
83
+ <div class="BigButton btnNext " rel="tooltip" title="#{labels.rotate_left }" data-placement="#{_settings.data_placement}" ><span class="icon-fast-backward " aria-hidden="true"></span></div>
84
+ <div class="BigButton btnMove " rel="tooltip" title="#{labels.play_stop }" data-placement="#{_settings.data_placement}" ><span class="icon-play" aria-hidden="true"></span></div>
85
+ <div class="BigButton btnPrevious " rel="tooltip" title="#{labels.rotate_right }" data-placement="#{_settings.data_placement}" ><span class="icon-fast-forward" aria-hidden="true"></span></div>
86
+ </div>
87
+ """
88
+
89
+ navBigButtons = _navBar.append(navControllers).find(".BigButton")
90
+
91
+ # Recarrega as core functions do twitter bootstrap
92
+ $.loadBootstrap()
93
+
94
+ if _settings.zoom
95
+ btZoom = $(".btnZoom", _navBar)
96
+ .addClass("in")
97
+ .click ->
98
+ if _t.zoom("value") is 1
99
+ _t.zoom("zoomIn")
100
+ else
101
+ _t.zoom("zoomOut")
102
+
103
+ btControls = $(".barControls", _navBar)
104
+ .addClass("in")
105
+ # Botão de play ou pausa
106
+ .find(".btnMove")
107
+ .click (e) ->
108
+ e.preventDefault()
109
+ span = $('span', this)
110
+ if span.hasClass("icon-play")
111
+ span.removeClass("icon-play").addClass("icon-pause")
112
+ move("start")
113
+ else
114
+ span.removeClass("icon-pause").addClass("icon-play")
115
+ move("stop")
116
+ .end()
117
+ # Botão para rotacioar para a esquerda
118
+ .find(".btnPrevious")
119
+ .mousedown (e) ->
120
+ e.preventDefault()
121
+ move("start", "left")
122
+ .mouseup (e) ->
123
+ e.preventDefault()
124
+ move("stop")
125
+ .end()
126
+ # Botão para rotacionar para a direita
127
+ .find(".btnNext")
128
+ .mousedown (e) ->
129
+ e.preventDefault()
130
+ move("start", "right")
131
+ .mouseup (e) ->
132
+ e.preventDefault()
133
+ move("stop")
134
+ .end()
135
+
136
+ # Faz a chamada na ação de avançar ou parar conforme a direção informada ou definida na configuração
137
+ move = (action="start", direction) ->
138
+ unless _panorama.length
139
+ console.error "Não tem como mover um panorama que não existe :( !"
140
+ return false
141
+
142
+ _settings.direction = direction if direction
143
+
144
+ # para o panorama caso ele ja esteja rotacionando e/ou caso a ação indique isso e altera o icone de pausa para play
145
+ # Caso a ação indique para iniciar rotação, o panorama é iniciado e a variável data-started é definida como true
146
+ btnMove = $(".btnMove span", _navBar)
147
+
148
+ # Caso já iniciado para a animação
149
+ if _panorama.data('started')
150
+ stop()
151
+
152
+ # Caso a ação seja iniciar, começa a animação
153
+ if action is 'start'
154
+ tour_animate()
155
+ _panorama.data('started', true)
156
+ btnMove.removeClass("icon-play").addClass("icon-pause")
157
+
158
+ stop = () ->
159
+ btnMoveSpan = $(".btnMove span", _navBar)
160
+ _panorama.stop()
161
+ _panorama.data('started', false)
162
+ btnMoveSpan.removeClass("icon-pause").addClass("icon-play")
163
+
164
+ rtRender = (element, panoramaViewport) ->
165
+ _t = element
166
+
167
+ element
168
+ .addClass("rtObject")
169
+ .attr("unselectable", "on")
170
+ .css
171
+ position: "relative"
172
+ "-moz-user-select": "none"
173
+ "-webkit-user-select": "none"
174
+ margin: "0"
175
+ padding: "0"
176
+ border: "none"
177
+ height: "#{panoramaViewport.innerHeight()}px"
178
+ .wrap "<div class='rtContainer' style='width: #{element[0].naturalWidth}px;'></div>"
179
+
180
+ _settings.imageSizes = {}
181
+ $.each "clientHeight clientWidth naturalHeight naturalWidth".split(' '), (ix, val) ->
182
+ _settings.imageSizes[val] = element[0][val]
183
+
184
+ element.clone().insertAfter element if _settings.mode_360
185
+
186
+ _panorama = element.parent()
187
+ .css
188
+ width: ((_settings.imageSizes.clientWidth * 2) + (_settings.imageSizes.clientWidth * 0.02))
189
+ overflow: "hidden"
190
+ .append("<div class=\"overlay-block\"></div>")
191
+ .appendTo(panoramaViewport)
192
+
193
+
194
+ # Movimentação por click
195
+ bMouseMove = false
196
+ mouseMoveStart = 0
197
+
198
+ panoramaViewport
199
+ .mousedown (e) ->
200
+ unless bMouseMove
201
+ bMouseMove = true
202
+ mouseMoveStart = e.clientX
203
+ false
204
+ .mouseup ->
205
+ bMouseMove = false
206
+ mouseMoveStart = 0
207
+ false
208
+ .mousemove (e) ->
209
+ if bMouseMove
210
+ delta = parseInt((mouseMoveStart - e.clientX) / 30)
211
+ if (delta > 10) or (delta < 10)
212
+ newMarginLeft = parseInt(_panorama.css("marginLeft")) - (delta)
213
+ if _settings.mode_360
214
+ newMarginLeft = -_settings.imageSizes.clientWidth if newMarginLeft > 0
215
+ newMarginLeft = 0 if newMarginLeft < -_settings.imageSizes.clientWidth
216
+ else
217
+ newMarginLeft = 0 if newMarginLeft > 0
218
+ newMarginLeft = -_settings.imageSizes.clientWidth if newMarginLeft < -_settings.imageSizes.clientWidth
219
+ _panorama.css "marginLeft", newMarginLeft + "px"
220
+
221
+ _panorama.css "margin-left": "-#{_settings.start_position}px"
222
+
223
+ panoramaViewport.find('.rtOverlayContainer').hide ->
224
+ $(this).remove()
225
+ _createNavBar()
226
+
227
+ move("start") if _settings.auto_start
228
+
229
+ @each ->
230
+ _element = _t = $(this)
231
+
232
+ $parent = _t.parent().css('overflow', 'hidden')
233
+
234
+ _settings.viewSize =
235
+ height : parseInt($parent.innerHeight() )
236
+ width : parseInt($parent.innerWidth() )
237
+
238
+ _settings.viewport_width = if _settings.viewport_width is 'auto' then _settings.viewSize.width else _settings.viewport_width
239
+
240
+ _viewPort = panoramaViewport = $("<div />")
241
+ .attr('id', "pan_#{_id++}")
242
+ .addClass("requestTour rtViewport rtHor")
243
+ .css
244
+ width : "#{_settings.viewport_width}px"
245
+ height : "#{_settings.viewSize.height}px"
246
+ overflow : "hidden"
247
+ .appendTo($parent)
248
+
249
+ # Loading
250
+ loadingHtml = """
251
+ <div class="rtOverlayContainer fade">
252
+ <div class="rtOverlay"></div>
253
+ <div class="rtLoading"></div>
254
+ </div>
255
+ """
256
+ rtLoading = $(loadingHtml)
257
+ .addClass('in')
258
+ .appendTo(panoramaViewport)
259
+
260
+ int = window.setInterval( ->
261
+ if _t[0].complete
262
+ clearInterval(int)
263
+ rtRender(_t, panoramaViewport)
264
+ , 100)
@@ -0,0 +1,212 @@
1
+ .requestTour {
2
+ overflow: hidden;
3
+ margin: 0;
4
+ padding: 0;
5
+ text-align: left;
6
+
7
+ .rtOverlayContainer {
8
+ z-index: 1010;
9
+
10
+ &,
11
+ .rtOverlay,
12
+ .rtLoading {
13
+ position: absolute;
14
+ }
15
+
16
+ &, .rtOverlay {
17
+ top: 0;
18
+ bottom: 0;
19
+ left: 0;
20
+ right: 0;
21
+ }
22
+ .rtOverlay {
23
+ background: #000;
24
+ opacity: .9;
25
+ }
26
+ .rtLoading {
27
+ $bs: 0 1px 3px rgba(255, 255, 255, 0.5);
28
+ $br: 10px;
29
+ $size: 138px;
30
+
31
+ background: url('loading.gif') no-repeat 50% 50% scroll #000;
32
+ width: $size;
33
+ height: $size;
34
+ top: 50%;
35
+ left: 50%;
36
+ margin-top: -($size + $br)/2;
37
+ margin-left: -($size + $br)/2;
38
+ padding: $br 0 0 $br;
39
+
40
+ -webkit-border-radius: $br;
41
+ -moz-border-radius: $br;
42
+ border-radius: $br;
43
+ -webkit-box-shadow: $bs;
44
+ -moz-box-shadow: $bs;
45
+ box-shadow: $bs;
46
+ }
47
+ }
48
+
49
+ .rtContainer {
50
+ position: relative;
51
+ // width: 100%;
52
+ width: 100000px;
53
+ margin: 0;
54
+ padding: 0;
55
+
56
+ .rtObject {
57
+ position: relative;
58
+ margin: 0;
59
+ padding: 0;
60
+ border: none;
61
+ top: 0;
62
+ bottom: 0;
63
+ }
64
+ .rtArea {
65
+ border: 2px solid white;
66
+ filter: alpha(opacity=20);
67
+ opacity: .2;
68
+ background: black;
69
+ font-size: 100%;
70
+ cursor: pointer;
71
+ text-decoration: none;
72
+ color: white;
73
+ text-align: right;
74
+
75
+ &:hover {
76
+ background: #0080e2;
77
+ cursor: pointer;
78
+ }
79
+ }
80
+ }
81
+
82
+ /* Button Sprite */
83
+ .rtArrowIcn,
84
+ .rtBigButtonIcn {
85
+ position: absolute;
86
+ cursor: pointer;
87
+ background: url('rdcms/sliders/sprite.png');
88
+ background-color: rgba(0,0,0,0.75);
89
+ *background-color: #111;
90
+
91
+ &:hover { background-color: rgba(0,0,0,0.9); }
92
+ }
93
+ /* Arrow */
94
+ .rtArrow {
95
+ height: 100%;
96
+ width: 44px;
97
+ position: absolute;
98
+ display: block;
99
+ cursor: pointer;
100
+ z-index: 21;
101
+
102
+ opacity: 1;
103
+ -webkit-transition:opacity 0.3s linear;
104
+ -moz-transition:opacity 0.3s linear;
105
+ -o-transition:opacity 0.3s linear;
106
+ transition:opacity 0.3s linear;
107
+ .rtArrowIcn {
108
+ width: 32px;
109
+ height: 32px;
110
+ top: 50%;
111
+ left: 50%;
112
+ margin-top:-16px;
113
+ margin-left: -16px;
114
+
115
+
116
+ border-radius: 2px;
117
+ }
118
+ }
119
+
120
+ /* Arrow > Horizontal [Default] */
121
+ &.rtHor {
122
+ .rtArrowLeft { top: 0; left: 0; }
123
+ .rtArrowRight { top:0; right: 0; }
124
+ .rtArrowLeft .rtArrowIcn { background-position: -64px -32px; }
125
+ .rtArrowRight .rtArrowIcn { background-position: -64px -64px; }
126
+ }
127
+
128
+ /* Arrow > Vertical */
129
+ &.rtVer {
130
+ .rtArrow { width: 100%; height: 44px; }
131
+ .rtArrowLeft { top: 0; left: 0; }
132
+ .rtArrowRight { bottom: 0; left: 0; }
133
+ .rtArrowLeft .rtArrowIcn { background-position: -96px -32px; }
134
+ .rtArrowRight .rtArrowIcn { background-position: -96px -64px; }
135
+ }
136
+
137
+ /* Botões de Navegação */
138
+ .rtBtnNavContainer {
139
+ position: absolute;
140
+ right: 10px;
141
+ top: 10px;
142
+ height: 50px;
143
+ z-index: 2000;
144
+
145
+ .rtBigButton {
146
+ $bigButtonSize: 40px;
147
+ width: $bigButtonSize;
148
+ height: $bigButtonSize;
149
+ z-index: 22;
150
+ display: inline-block;
151
+ position: relative;
152
+ cursor: pointer;
153
+
154
+ .rtBigButtonIcn {
155
+ width: $bigButtonSize;
156
+ height: $bigButtonSize;
157
+ top: 50%;
158
+ left: 50%;
159
+ margin-top: -22px;
160
+ margin-left: -22px;
161
+ border-radius: 4px;
162
+ }
163
+ }
164
+
165
+ .rtFullscreen .rtBigButtonIcn { background-position: 4px 5px; }
166
+ .rtDefaultscreen .rtBigButtonIcn { background-position: -28px 5px; }
167
+ .rtPlayBtn .rtBigButtonIcn { background-position: -13px -44px; }
168
+ .rtPauseBtn .rtBigButtonIcn { background-position: -57px -99px; }
169
+ }
170
+
171
+ /* Desabilitado */
172
+ .rtArrowDisabled .rtArrowIcn { background-color: rgba(0,0,0,0.4); opacity: .4; *display: none; }
173
+
174
+ /* Ocultar */
175
+ .rtHidden {
176
+ opacity: 0;
177
+ visibility: hidden;
178
+ -webkit-transition:visibility 0s linear 0.3s,opacity 0.3s linear;
179
+ -moz-transition:visibility 0s linear 0.3s,opacity 0.3s linear;
180
+ -o-transition:visibility 0s linear 0.3s,opacity 0.3s linear;
181
+ transition:visibility 0s linear 0.3s,opacity 0.3s linear;
182
+ }
183
+ /* Fullscreen options, very important ^^ */
184
+ &.rtFullscreen {
185
+ position: fixed !important;
186
+ height: auto !important;
187
+ width: auto !important;
188
+ margin: 0 !important;
189
+ padding: 0 !important;
190
+ z-index: 2147483647 !important;
191
+ top: 0 !important;
192
+ left: 0 !important;
193
+ bottom: 0 !important;
194
+ right: 0 !important;
195
+ }
196
+ }
197
+ .rtWebkit3d {
198
+ .rtViewport,
199
+ .rtContainer,
200
+ .rtPreloader,
201
+ img,
202
+ .rtArrow,
203
+ .rtControllerToobar {
204
+ -webkit-backface-visibility: hidden;
205
+ -webkit-transform: translateZ(0);
206
+ }
207
+ .rtFade .rtSlide,
208
+ .rtFade img,
209
+ .rtFade .rtContainer {
210
+ -webkit-transform: none;
211
+ }
212
+ }
@@ -0,0 +1,18 @@
1
+ class ToursController < ApplicationController
2
+ load_and_authorize_resource
3
+
4
+ respond_to :html, :json
5
+ def index
6
+ @tours = Tour.ordained.all
7
+ respond_with @tours
8
+ end
9
+
10
+ def show
11
+ @tour = Tour.find(params[:id])
12
+ @tour.visit! :by => request.try(:remote_ip)
13
+
14
+ respond_with @tour do |format|
15
+ format.html { render layout: 'full_screen' }
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,42 @@
1
+ class Tour < ActiveRecord::Base
2
+ attr_accessible :body, :name, :position, :published, :speed, :direction, :control_display, :start_position, :loop, :auto_start,
3
+ # Slug, I18n e tags
4
+ :slug, :locale, :translations_attributes, :tag_list,
5
+ # Paperclip
6
+ :tour, :tour_content_type, :tour_file_name, :tour_file_size
7
+ # Taggings
8
+ acts_as_taggable
9
+
10
+ has_attached_file :tour,
11
+ :styles => {
12
+ :thumb => "560x180#"
13
+ },
14
+ :convert_options => { :all => '-auto-orient -quality 70 -interlace Plane' }
15
+ # :processors => [:thumbnail, :compression]
16
+
17
+ # URL amigáveis através do :name
18
+ extend FriendlyId
19
+ friendly_id :name, use: [:slugged, :history]
20
+
21
+ # Escopos
22
+ scope :visible, where("published = ?", true)
23
+ scope :recents, lambda{ |limit = 10| visible.order("datetime desc").limit(limit)}
24
+ scope :ordained, lambda{ |limit = 10| visible.order("position asc").limit(limit)}
25
+
26
+ # Contador de visitas
27
+ is_visitable accept_ip: true
28
+
29
+ # Translate
30
+ translates :name, :body
31
+ accepts_nested_attributes_for :translations
32
+
33
+ class Translation
34
+ attr_accessible :locale, :name, :body
35
+ end
36
+ def translations_attributes=(attributes)
37
+ new_translations = attributes.values.reduce({}) do |new_values, translation|
38
+ new_values.merge! translation.delete("locale") => translation
39
+ end
40
+ set_translations new_translations
41
+ end
42
+ end
@@ -0,0 +1,35 @@
1
+ <%= semantic_form_for [:admin, @tour], :html => { :multipart => true, class: 'form-horizontal' } do |f| %>
2
+ <%= errors_for @tour %>
3
+
4
+ <%= f.globalize_inputs :translations do |lf| %>
5
+ <div class="control-group">
6
+ <%= lf.label :name, t(".name"), :class => 'control-label' %>
7
+ <div class="controls">
8
+ <%= lf.text_field :name, :class => 'text_field' %>
9
+ </div>
10
+ </div>
11
+ <div class="control-group">
12
+ <%= lf.label :body, t(".body"), :class => 'control-label' %>
13
+ <div class="controls">
14
+ <%= lf.cktext_area :body, :class => 'text_area' %>
15
+ </div>
16
+ </div>
17
+ <%= lf.input :locale, :as => :hidden %>
18
+ <% end %>
19
+
20
+ <hr />
21
+
22
+ <div class="control-group">
23
+ <%= f.label :tour, t(".background"), :class => 'control-label' %>
24
+ <div class="controls">
25
+ <%= f.file_field :tour, :accept => "image/*" %>
26
+ </div>
27
+ </div>
28
+
29
+ <hr />
30
+
31
+ <div class="form-actions">
32
+ <%= f.submit :class => 'btn btn-primary' %>
33
+ <%= link_to t(".cancel"), admin_tours_path, :class => 'btn btn-link cancel' %>
34
+ </div>
35
+ <% end %>
@@ -0,0 +1,41 @@
1
+ <div class="panel">
2
+ <h3><%= t "permalink" %>: <%= link_to tour_path(s), tour_path(s), target: "_blank" %></h3>
3
+ <div class="panel_contents" id="details">
4
+ <div class="attributes_table">
5
+ <table class="table table-bordered">
6
+ <tbody>
7
+ <tr><th><%= t(".name" ) %></th><td><%= s.name %></td></tr>
8
+ <tr><th><%= t(".tag_list" ) %></th><td><%= best_in_place s, :tag_list, type: :input, path: [:admin, s] %></td></tr>
9
+ <tr><th><%= t(".created_at" ) %></th><td><%= l s.created_at %></td></tr>
10
+ <tr><th><%= t(".updated_at" ) %></th><td><%= l s.updated_at %></td></tr>
11
+ <tr><th><%= t(".published" ) %></th><td><%= best_in_place s, :published, type: :checkbox , path: [:admin, s] %></td></tr>
12
+ </tbody>
13
+ </table>
14
+ </div>
15
+ </div>
16
+ <h3><%= t "options" %></h3>
17
+ <div class="panel_contents" id="details">
18
+ <div class="attributes_table">
19
+ <table class="table table-bordered">
20
+ <tbody>
21
+ <tr><th><%= t(".speed" ) %></th><td><%= best_in_place s, :speed , type: :input , path: [:admin, s], :nil => "0" %></td></tr>
22
+ <tr><th><%= t(".direction" ) %></th><td><%= best_in_place s, :direction , type: :select, path: [:admin, s],
23
+ :collection => [["right" , I18n.t(".right" ) ],
24
+ ["left" , I18n.t(".left" ) ]]
25
+ %></td></tr>
26
+ <tr><th><%= t(".control_display") %></th><td><%= best_in_place s, :control_display, type: :checkbox , path: [:admin, s] %></td></tr>
27
+ <tr><th><%= t(".auto_start" ) %></th><td><%= best_in_place s, :auto_start , type: :checkbox , path: [:admin, s] %></td></tr>
28
+ <tr><th><%= t(".start_position" ) %></th><td><%= best_in_place s, :start_position , type: :input , path: [:admin, s] %></td></tr>
29
+ <tr><th><%= t(".loop" ) %></th><td><%= best_in_place s, :loop , type: :checkbox , path: [:admin, s] %></td></tr>
30
+ </tbody>
31
+ </table>
32
+ </div>
33
+ </div>
34
+ <h3><%= t "description" %></h3>
35
+ <div class="panel_contents" id="description">
36
+ <div class="attributes_table well">
37
+ <%= image_tag s.tour(:thumb), class: "thumbnail pull-right" %>
38
+ <%= s.body.html_safe if s.body %>
39
+ </div>
40
+ </div>
41
+ </div>
@@ -0,0 +1,25 @@
1
+ <div class="row">
2
+ <div id="tour-list-container" class="<%= defined?(list_class) ? list_class : "span12" %>">
3
+ <% unless defined?(disable_social) and disable_social %>
4
+ <div class="social-container" data-url="<%= tours_url %>"></div>
5
+ <script type="text/javascript" charset="utf-8">
6
+ $('.social-container').social(<%= raw social_buttons_json %>);
7
+ </script>
8
+ <% end -%>
9
+ <ul class="thumbnails">
10
+ <% @tours.each do |tour| %>
11
+ <li class="<%= defined?(list_class) ? list_class : "span6" %>">
12
+ <div class="thumbnail tour-list clearfix">
13
+ <h3><%= link_to tour.name, tour_path(tour) %></h3>
14
+ <%= link_to(tour_path(tour), { title: tour.name, class: "thumb" }) do %>
15
+ <%= image_tag tour.tour(:thumb), class: "img-rounded" %>
16
+ <% end %>
17
+ <div class="details clearfix">
18
+ <%= tour.body.html_safe %>
19
+ </div>
20
+ </div>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ </div>
25
+ </div>
@@ -0,0 +1,44 @@
1
+ <%- content_for :title, "#{@tour.name} - #{Tour.model_name.human} - #{Setting.for_key("rdcms.site.name")}" -%>
2
+
3
+ <%- content_for :navegation_link do %>
4
+ <%= link_to "<span class=\"icon-back\" aria-hidden=\"true\"></span>".html_safe, tours_path, class: "BigButton fade in btnBack", rel: "tooltip", title: I18n.t("back") %>
5
+ <% end -%>
6
+
7
+ <%= image_tag @tour.tour, class: "panorama" %>
8
+
9
+ <script type="text/javascript" charset="utf-8">
10
+ var Tour_labels = {
11
+ index : '<%= I18n.t "attributes_all.index" %>',
12
+ rotate_left : '<%= I18n.t "attributes_all.rotate_left" %>',
13
+ rotate_right : '<%= I18n.t "attributes_all.rotate_right" %>',
14
+ play_stop : '<%= I18n.t "attributes_all.play_stop" %>',
15
+ zoom : '<%= I18n.t "attributes_all.zoom" %>',
16
+ };
17
+ </script>
18
+
19
+ <%= stylesheet_link_tag "tours" %>
20
+ <%= javascript_include_tag "tours" %>
21
+
22
+ <script type="text/javascript" charset="utf-8">
23
+ $(function () {
24
+ // Initialize the jQuery File Upload widget:
25
+ tour = $(".panorama").tour({
26
+ navBarContainer: "footer .navbar:first > .navbar-inner > .container",
27
+ data_placement: "top",
28
+ <%= "speed : #{@tour.speed},".html_safe if defined?(@tour.speed ) %>
29
+ <%= "direction : '#{@tour.direction}',".html_safe if defined?(@tour.direction ) %>
30
+ <%= "control_display : #{@tour.control_display},".html_safe if defined?(@tour.control_display ) %>
31
+ <%= "start_position : #{@tour.start_position},".html_safe if defined?(@tour.start_position ) %>
32
+ <%= "auto_start : #{@tour.auto_start},".html_safe if defined?(@tour.auto_start ) %>
33
+ <%= "mode_360 : #{@tour.loop},".html_safe if defined?(@tour.loop ) %>
34
+ });
35
+ });
36
+ </script>
37
+
38
+ <!-- Botões Sociais -->
39
+ <% content_for :social_buttons do -%>
40
+ <div class="social-container" data-url="<%= tour_url(@tour) %>"></div>
41
+ <script type="text/javascript" charset="utf-8">
42
+ $('.social-container').social(<%= raw social_buttons_json %>);
43
+ </script>
44
+ <% end unless defined?(disable_social) and disable_social -%>
@@ -0,0 +1,35 @@
1
+ class CreateTours < ActiveRecord::Migration
2
+ def change
3
+ create_table :tours do |t|
4
+ t.string :slug
5
+ t.string :name
6
+ t.text :body
7
+ t.integer :position
8
+ t.boolean :published, :default => false
9
+
10
+ # Options
11
+ t.integer :speed , :default => 20000
12
+ t.string :direction , :default => 'left'
13
+ t.boolean :control_display, :default => true
14
+ t.integer :start_position , :default => 0
15
+ t.boolean :loop , :default => true
16
+ t.boolean :auto_start , :default => false
17
+
18
+ t.string :tour_file_name
19
+ t.string :tour_content_type
20
+ t.integer :tour_file_size
21
+
22
+ t.timestamps
23
+ end
24
+
25
+ add_index :tours, :name
26
+ add_index :tours, :slug, :unique => true
27
+
28
+ Tour.create_translation_table! :name => :string, :body => :text
29
+ end
30
+
31
+ def down
32
+ drop_table :tours
33
+ Tour.drop_translation_table!
34
+ end
35
+ end
data/lib/rdcms_tour.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "rdcms_tour/engine"
2
+
3
+ module RdcmsTour
4
+ end
@@ -0,0 +1,9 @@
1
+ require 'rails'
2
+ require "i18n"
3
+ require 'active_admin'
4
+
5
+ module RdcmsTour
6
+ class Engine < Rails::Engine
7
+ isolate_namespace RdcmsTour
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module RdcmsTour
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rdcms_tour/version'
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "rdcms_tour"
8
+ s.version = RdcmsTour::VERSION
9
+ s.authors = ["Gullit Miranda"]
10
+ s.email = ["gullitmiranda@requestdev.com.br"]
11
+ s.homepage = "http://www.requestdev.com.br/rdcms/tours"
12
+ s.summary = %q{Módulo de Panorâmas para o RDCMS}
13
+ s.description = %q{O Rdcms Tour é o módulo para paranoramas, onde é possivel ter uma visão panorâmica (até 360 graus) de ambientes fazendo a marcação de itens de destaque.}
14
+ s.license = "MIT"
15
+
16
+ s.files = `git ls-files`.split($/)
17
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency "bundler", "~> 1.3"
22
+ s.add_development_dependency "rake"
23
+
24
+ # Dependências
25
+ s.add_dependency "rdcms", "~> 1.0.21"
26
+ end
data/script/rails ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ ENGINE_ROOT = File.expand_path('../..', __FILE__)
5
+ ENGINE_PATH = File.expand_path('../../lib/rdcms_tour/engine', __FILE__)
6
+
7
+ require 'rails/all'
8
+ require 'rails/engine/commands'
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rdcms_tour
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gullit Miranda
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-06-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdcms
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.21
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.21
55
+ description: O Rdcms Tour é o módulo para paranoramas, onde é possivel ter uma visão
56
+ panorâmica (até 360 graus) de ambientes fazendo a marcação de itens de destaque.
57
+ email:
58
+ - gullitmiranda@requestdev.com.br
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - .gitignore
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - admin/tours.rb
69
+ - app/assets/javascripts/tours.js.coffee
70
+ - app/assets/stylesheets/tours.css.scss
71
+ - app/controllers/tours_controller.rb
72
+ - app/models/tour.rb
73
+ - app/views/admin/tours/_form.html.erb
74
+ - app/views/admin/tours/_show.html.erb
75
+ - app/views/tours/index.html.erb
76
+ - app/views/tours/show.html.erb
77
+ - db/migrate/20130603134344_create_tours.rb
78
+ - lib/rdcms_tour.rb
79
+ - lib/rdcms_tour/engine.rb
80
+ - lib/rdcms_tour/version.rb
81
+ - rdcms_tour.gemspec
82
+ - script/rails
83
+ homepage: http://www.requestdev.com.br/rdcms/tours
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.0.2
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Módulo de Panorâmas para o RDCMS
107
+ test_files: []