rdcms_tour 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f36c06633d8ff5d33d5e034e64ee002a488a089b
4
- data.tar.gz: ca858a9d2dbb4d175047388144c109de8ca91de9
3
+ metadata.gz: de2a8633d83106c1f162c11b2711e82979ff4f29
4
+ data.tar.gz: bb77e6c8bcea96ad9d2ea828ff45b64498a6649e
5
5
  SHA512:
6
- metadata.gz: 25d52bcc0af5af448b5ed0ff5fd97576739c9d9a1f6c6a502c92ce9b144bda4062fce384f12f76645197f2bf087bce344e7ba2ac66c85893c45fd5dc134aacdb
7
- data.tar.gz: 3a5c3a862f24ad3351fac1fff29742c757ccb8888190b9f852d1d9a522d7c3cf4cf51d5c525377dd13663ad0ad3a655fca63cdf73fdc42e7968bc317539cab8f
6
+ metadata.gz: 15f5457f2785acd08e3b86fcd1a807c85c836bc566d6b561efdadb781207b2f48f952216b232e96c278cfe3affc118c171a439c20b0e7eda7982dd893134e2c8
7
+ data.tar.gz: 59a484dfda57c071271ed449898c5456598bcc323278fe1f1b4e73ce5ea468867a879cbe9186f42087c2079b53c5e98c066310feb446742f3ce0a1b91bccf0cb
data/.gitignore CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE.txt CHANGED
File without changes
data/README.md CHANGED
@@ -18,6 +18,13 @@ ou instale-a diretamente execultando:
18
18
  gem install rdcms_tour
19
19
 
20
20
 
21
+ adicione as rotas:
22
+
23
+ # config/routes.rb
24
+ resources :tours, :only => [:index, :show] do
25
+ resources :marcations
26
+ end
27
+
21
28
  instale as migrações:
22
29
 
23
30
  # $
data/Rakefile CHANGED
File without changes
data/admin/tours.rb CHANGED
File without changes
@@ -41,12 +41,12 @@ jQuery ->
41
41
  currentPosition = 0 - parseInt(_panorama.css("margin-left"))
42
42
 
43
43
  if _settings.direction is "right"
44
- _panorama.animate marginLeft: 0 , ((_settings.speed / _settings.imageSizes.clientWidth) * (currentPosition)), "linear", ->
44
+ _panorama.animate marginLeft: 0 , ((_settings.speed / _settings.imageSizes["width"]) * (currentPosition)), "linear", ->
45
45
  if _settings.mode_360
46
- _panorama.css "marginLeft", "-#{parseInt(_settings.imageSizes.clientWidth)}px"
46
+ _panorama.css "marginLeft", "-#{parseInt(_settings.imageSizes["width"])}px"
47
47
  tour_animate()
48
48
  else
49
- rightlimit = if _settings.mode_360 then _settings.imageSizes.clientWidth else (_settings.imageSizes.clientWidth - _settings.viewport_width)
49
+ rightlimit = if _settings.mode_360 then _settings.imageSizes["width"] else (_settings.imageSizes["width"] - _settings.viewport_width)
50
50
 
51
51
  _panorama.animate
52
52
  marginLeft: -rightlimit
@@ -164,8 +164,17 @@ jQuery ->
164
164
  rtRender = (element, panoramaViewport) ->
165
165
  _t = element
166
166
 
167
+ _settings.imageSizes = {}
168
+ $.each "naturalHeight naturalWidth".split(' '), (ix, val) ->
169
+ _settings.imageSizes[val] = element[0][val]
170
+
171
+ _settings.imageSizes["height"] = _settings.viewSize["height"]
172
+ _settings.imageSizes["width"] = Math.round (_settings.imageSizes["height"] / _settings.imageSizes["naturalHeight"]) * _settings.imageSizes["naturalWidth"]
173
+
174
+ element = element.addClass("markregion-image").wrap("""<div />""").parent()
175
+
167
176
  element
168
- .addClass("rtObject")
177
+ .addClass("rtObject markregion")
169
178
  .attr("unselectable", "on")
170
179
  .css
171
180
  position: "relative"
@@ -174,20 +183,26 @@ jQuery ->
174
183
  margin: "0"
175
184
  padding: "0"
176
185
  border: "none"
177
- height: "#{panoramaViewport.innerHeight()}px"
178
- .wrap "<div class='rtContainer' style='width: #{element[0].naturalWidth}px;'></div>"
186
+ height: "#{_settings.imageSizes["height"]}px"
187
+ width: "#{_settings.imageSizes["width"]}px"
188
+ .wrap "<div class='rtContainer' />"
189
+ # .wrap "<div class='rtContainer' style='width: #{_settings.imageSizes["width"]}px;'></div>"
179
190
 
180
- _settings.imageSizes = {}
181
- $.each "clientHeight clientWidth naturalHeight naturalWidth".split(' '), (ix, val) ->
182
- _settings.imageSizes[val] = element[0][val]
191
+ # carrega as marcações
192
+ regions = element.markregion(
193
+ path: _settings.path
194
+ locale: _settings.locale
195
+ editable: _settings.editable
196
+ )
183
197
 
184
- element.clone().insertAfter element if _settings.mode_360
198
+ element.on "markregion-create", (ev) ->
199
+ element.clone().insertAfter element if _settings.mode_360
185
200
 
186
201
  _panorama = element.parent()
187
202
  .css
188
- width: ((_settings.imageSizes.clientWidth * 2) + (_settings.imageSizes.clientWidth * 0.02))
203
+ width: ((_settings.imageSizes["width"] * 2) + (_settings.imageSizes["width"] * 0.02))
189
204
  overflow: "hidden"
190
- .append("<div class=\"overlay-block\"></div>")
205
+ # .append("<div class=\"overlay-block\"></div>")
191
206
  .appendTo(panoramaViewport)
192
207
 
193
208
 
@@ -195,27 +210,32 @@ jQuery ->
195
210
  bMouseMove = false
196
211
  mouseMoveStart = 0
197
212
 
198
- panoramaViewport
213
+ # panoramaViewport
214
+ _panorama
199
215
  .mousedown (e) ->
200
216
  unless bMouseMove
201
217
  bMouseMove = true
202
218
  mouseMoveStart = e.clientX
219
+ $.mouseMoving = true
203
220
  false
204
221
  .mouseup ->
205
222
  bMouseMove = false
206
223
  mouseMoveStart = 0
224
+ $.mouseMoving = false
207
225
  false
208
226
  .mousemove (e) ->
209
227
  if bMouseMove
228
+ # console.debug "mousemove", e
210
229
  delta = parseInt((mouseMoveStart - e.clientX) / 30)
230
+ # console.debug "delta", delta
211
231
  if (delta > 10) or (delta < 10)
212
232
  newMarginLeft = parseInt(_panorama.css("marginLeft")) - (delta)
213
233
  if _settings.mode_360
214
- newMarginLeft = -_settings.imageSizes.clientWidth if newMarginLeft > 0
215
- newMarginLeft = 0 if newMarginLeft < -_settings.imageSizes.clientWidth
234
+ newMarginLeft = -_settings.imageSizes["width"] if newMarginLeft > 0
235
+ newMarginLeft = 0 if newMarginLeft < -_settings.imageSizes["width"]
216
236
  else
217
237
  newMarginLeft = 0 if newMarginLeft > 0
218
- newMarginLeft = -_settings.imageSizes.clientWidth if newMarginLeft < -_settings.imageSizes.clientWidth
238
+ newMarginLeft = -_settings.imageSizes["width"] if newMarginLeft < -_settings.imageSizes["width"]
219
239
  _panorama.css "marginLeft", newMarginLeft + "px"
220
240
 
221
241
  _panorama.css "margin-left": "-#{_settings.start_position}px"
@@ -226,6 +246,28 @@ jQuery ->
226
246
 
227
247
  move("start") if _settings.auto_start
228
248
 
249
+ initAnnotate = (element) ->
250
+ $(".annotate-image").annotateImage
251
+ useAjax: false
252
+ notes: [
253
+ top: 286
254
+ left: 161
255
+ width: 30
256
+ height: 30
257
+ text: "Small people on the steps"
258
+ id: "e69213d0-2eef-40fa-a04b-0ed998f9f1f5"
259
+ editable: false
260
+ ,
261
+ top: 134
262
+ left: 179
263
+ width: 30
264
+ height: 30
265
+ text: "National Gallery Dome"
266
+ id: "e7f44ac5-bcf2-412d-b440-6dbb8b19ffbe"
267
+ editable: true
268
+ ]
269
+
270
+
229
271
  @each ->
230
272
  _element = _t = $(this)
231
273
 
@@ -0,0 +1,203 @@
1
+ ###
2
+ @File : rd.markregion.js.coffee
3
+ @version : 0.5.0
4
+ @description : Cria marcação para tour virtual
5
+ @language : PT-BR Charset: UTF-8
6
+ @date : Sex Jul 19 14:54:00 AMT 2013
7
+
8
+ @package : RDCMS Tour
9
+
10
+ @author : Gullit Miranda <gullitmiranda@requestdev.com.br>
11
+
12
+ @copyright © RequestDev Sistemas 2011-2013, all right reserved.
13
+ http://www.requestdev.com.br
14
+ ###
15
+
16
+ jQuery ->
17
+ markregion =
18
+ # Marcadores
19
+ marcations: []
20
+
21
+ # Configurações padrão
22
+ defaults:
23
+ editable: false
24
+ resizable: false
25
+
26
+ # Urls para ajax
27
+ path: null
28
+
29
+ init: (obj, options) ->
30
+ self = @
31
+ @element = obj
32
+
33
+ @options = options = $.extend(true, {}, @defaults, options)
34
+
35
+ # remove localização
36
+ # @options.path = @options.path.replace(RegExp("^\/#{@options.locale}"), "") if @options.locale
37
+
38
+ if (@element.get(0).tagName == "IMG" or !@element.hasClass("markregion"))
39
+ @element = @element.wrap("<div class=\"markregion\" />").parent()
40
+
41
+
42
+ @image = @element.children(".markregion-image")
43
+ @view = $('<div class="markregion-view" />').appendTo(@element)
44
+ @modal = $("""
45
+ <div id="markregion-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
46
+ <div class="modal-body">
47
+ </div>
48
+ </div>""").appendTo(@element)
49
+
50
+ ###
51
+ <div class="modal-header">
52
+ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
53
+ <h3 id="myModalLabel">Editar Marcação</h3>
54
+ </div>
55
+ <div class="modal-footer">
56
+ <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
57
+ <button class="btn btn-primary">Save changes</button>
58
+ </div>
59
+ ###
60
+
61
+ @edit = $(""" <div class="markregion-edit">
62
+ <div class="markregion-edit-area" />
63
+ </div>""").appendTo(@element)
64
+
65
+
66
+ @sizes=
67
+ naturalWidth: @image[0].naturalWidth
68
+ naturalHeight: @image[0].naturalHeight
69
+ height: @element.height()
70
+ width: @element.width()
71
+
72
+
73
+ @element.parent().off ".markregion"
74
+
75
+ @element.parent().on("click.markregion", ".markregion", (ev) ->
76
+ if $(ev.target).hasClass("markregion-view")
77
+ parentOffset = $(@).parent().offset();
78
+ # or $(this).offset(); if you really just want the current element's offset
79
+ positions =
80
+ relX : ev.pageX - parentOffset.left
81
+ relY : ev.pageY - parentOffset.top
82
+
83
+ size_range = self.sizes.naturalHeight / self.sizes.height
84
+
85
+ naturalPositions =
86
+ relX : Math.round positions.relX * size_range
87
+ relY : Math.round positions.relY * size_range
88
+
89
+ marcation =
90
+ left: naturalPositions.relX
91
+ top: naturalPositions.relY
92
+
93
+ self.renderMarcations marcation, "new"
94
+ ) if @options.editable
95
+
96
+
97
+ @element.parent().on "mouseenter.markregion", ".markregion", (ev) ->
98
+ $(".markregion-view", ev.delegateTarget).show() if $(".markregion-edit", ev.delegateTarget).css("display") is "none"
99
+ @element.parent().on "mouseleave.markregion", ".markregion", (ev) ->
100
+ $(".markregion-view", ev.delegateTarget).hide()
101
+
102
+ @load()
103
+ self
104
+
105
+
106
+ # Carrega as marcações
107
+ load: ->
108
+ return false unless @options.path
109
+ $.getJSON @options.path.index, (data) =>
110
+ @marcations = data
111
+ @renderMarcations()
112
+
113
+ # Renderiza as marcações
114
+ renderMarcations: (marcation, action) ->
115
+ self = @
116
+ marcations = if marcation then [marcation] else @marcations
117
+ action = action || "edit"
118
+ $.each marcations, (i) ->
119
+ marcation = @
120
+
121
+ if action is "new"
122
+ params = $.param(marcation: marcation, false)
123
+ path = "#{self.options.path.new}?#{params}"
124
+ else
125
+ path = @path.edit
126
+
127
+ # definendo o posicionamento
128
+ @positions= if self.image.length
129
+ left: (@left * self.sizes.width) / self.sizes.naturalWidth
130
+ top: (@top * self.sizes.height) / self.sizes.naturalHeight
131
+ else
132
+ left: @left
133
+ top: @top
134
+
135
+ # Caso a marcação já exista remove-la
136
+ exist_marcation = $("#{@id}.markregion-area, .markregion-area.markregion-area-new")
137
+ exist_marcation.remove() if exist_marcation.length
138
+
139
+ modal_link = $(if self.options.editable then """<a href="#{path}" role="button" data-target="#markregion-modal" />""" else "<span />")
140
+
141
+ modal_link
142
+ .addClass("markregion-modal-link")
143
+ .append("""<i class="icon-search" />""")
144
+
145
+ area = $("""
146
+ <div />""")
147
+ .attr("id", @id)
148
+ .addClass("markregion-area #{"markregion-area-new" unless @id}")
149
+ .append(modal_link)
150
+ # <a href="#{@path.edit}" class="markregion-modal-link" role="button" data-toggle="modal" data-target="#markregion-modal"><i class="icon-search" /> </a>
151
+ .appendTo(self.view)
152
+ .css
153
+ left: @positions.left
154
+ top: @positions.top
155
+
156
+ link = $("""<div id=\"#{@id}\" class=\"markregion-note\"><a href=\"#{@url || ""}\" target="_blank" >#{@body}</a></div>""")
157
+ .appendTo(area)
158
+
159
+
160
+ # se for editável, ao clicar no icone cria o form
161
+ modal_link = area.children(".markregion-modal-link").click( (ev) ->
162
+ ev.preventDefault()
163
+ self.formMarcation("#{action}", $(@), marcation)
164
+ ) if self.options.editable
165
+
166
+ modal_link.trigger("click") if action is "new" and modal_link.length
167
+
168
+ # Execulta o evento de pós criação
169
+ self.element.trigger("markregion-create", marcation)
170
+
171
+ # Edição da maracção
172
+ formMarcation: (action, link, marcation) ->
173
+ return false unless marcation
174
+ self = @
175
+ modal = $(link.data("target")).load link.prop("href"), (data) ->
176
+ $this = $(this)
177
+
178
+ form = $("form:first", $this).on "submit", (ev) ->
179
+ ev.preventDefault()
180
+ $.ajax
181
+ type: form.attr("method") || "PUT"
182
+ url: form.attr("action")
183
+ data: form.serialize()
184
+ dataType: "json"
185
+ .done (data, status) ->
186
+ self.renderMarcations(data)
187
+ $this.modal("hide")
188
+ # .fail (data, status) ->
189
+ # console.debug status, data
190
+
191
+ $("#markregion-modal").modal("hide");
192
+
193
+ $this.modal("show")
194
+
195
+ # fixbug firefox focus
196
+ $("input", $this).on "click", ((ev) -> $(this).select() )
197
+ @
198
+
199
+
200
+ $.fn.markregion = (options) ->
201
+ @each ->
202
+ markregion.init $(this), options
203
+
@@ -0,0 +1,2 @@
1
+ //= require tour/rd.markregion
2
+ //= require tour/landscape
@@ -0,0 +1,219 @@
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
+ display: inline-block;
64
+ img {
65
+ // width: 100%;
66
+ height: 100%;
67
+ max-width: none;
68
+ // width: auto;
69
+ }
70
+ }
71
+ .rtArea {
72
+ border: 2px solid white;
73
+ filter: alpha(opacity=20);
74
+ opacity: .2;
75
+ background: black;
76
+ font-size: 100%;
77
+ cursor: pointer;
78
+ text-decoration: none;
79
+ color: white;
80
+ text-align: right;
81
+
82
+ &:hover {
83
+ background: #0080e2;
84
+ cursor: pointer;
85
+ }
86
+ }
87
+ }
88
+
89
+ /* Button Sprite */
90
+ .rtArrowIcn,
91
+ .rtBigButtonIcn {
92
+ position: absolute;
93
+ cursor: pointer;
94
+ background: url('rdcms/sliders/sprite.png');
95
+ background-color: rgba(0,0,0,0.75);
96
+ *background-color: #111;
97
+
98
+ &:hover { background-color: rgba(0,0,0,0.9); }
99
+ }
100
+ /* Arrow */
101
+ .rtArrow {
102
+ height: 100%;
103
+ width: 44px;
104
+ position: absolute;
105
+ display: block;
106
+ cursor: pointer;
107
+ z-index: 21;
108
+
109
+ opacity: 1;
110
+ -webkit-transition:opacity 0.3s linear;
111
+ -moz-transition:opacity 0.3s linear;
112
+ -o-transition:opacity 0.3s linear;
113
+ transition:opacity 0.3s linear;
114
+ .rtArrowIcn {
115
+ width: 32px;
116
+ height: 32px;
117
+ top: 50%;
118
+ left: 50%;
119
+ margin-top:-16px;
120
+ margin-left: -16px;
121
+
122
+
123
+ border-radius: 2px;
124
+ }
125
+ }
126
+
127
+ /* Arrow > Horizontal [Default] */
128
+ &.rtHor {
129
+ .rtArrowLeft { top: 0; left: 0; }
130
+ .rtArrowRight { top:0; right: 0; }
131
+ .rtArrowLeft .rtArrowIcn { background-position: -64px -32px; }
132
+ .rtArrowRight .rtArrowIcn { background-position: -64px -64px; }
133
+ }
134
+
135
+ /* Arrow > Vertical */
136
+ &.rtVer {
137
+ .rtArrow { width: 100%; height: 44px; }
138
+ .rtArrowLeft { top: 0; left: 0; }
139
+ .rtArrowRight { bottom: 0; left: 0; }
140
+ .rtArrowLeft .rtArrowIcn { background-position: -96px -32px; }
141
+ .rtArrowRight .rtArrowIcn { background-position: -96px -64px; }
142
+ }
143
+
144
+ /* Botões de Navegação */
145
+ .rtBtnNavContainer {
146
+ position: absolute;
147
+ right: 10px;
148
+ top: 10px;
149
+ height: 50px;
150
+ z-index: 2000;
151
+
152
+ .rtBigButton {
153
+ $bigButtonSize: 40px;
154
+ width: $bigButtonSize;
155
+ height: $bigButtonSize;
156
+ z-index: 22;
157
+ display: inline-block;
158
+ position: relative;
159
+ cursor: pointer;
160
+
161
+ .rtBigButtonIcn {
162
+ width: $bigButtonSize;
163
+ height: $bigButtonSize;
164
+ top: 50%;
165
+ left: 50%;
166
+ margin-top: -22px;
167
+ margin-left: -22px;
168
+ border-radius: 4px;
169
+ }
170
+ }
171
+
172
+ .rtFullscreen .rtBigButtonIcn { background-position: 4px 5px; }
173
+ .rtDefaultscreen .rtBigButtonIcn { background-position: -28px 5px; }
174
+ .rtPlayBtn .rtBigButtonIcn { background-position: -13px -44px; }
175
+ .rtPauseBtn .rtBigButtonIcn { background-position: -57px -99px; }
176
+ }
177
+
178
+ /* Desabilitado */
179
+ .rtArrowDisabled .rtArrowIcn { background-color: rgba(0,0,0,0.4); opacity: .4; *display: none; }
180
+
181
+ /* Ocultar */
182
+ .rtHidden {
183
+ opacity: 0;
184
+ visibility: hidden;
185
+ -webkit-transition:visibility 0s linear 0.3s,opacity 0.3s linear;
186
+ -moz-transition:visibility 0s linear 0.3s,opacity 0.3s linear;
187
+ -o-transition:visibility 0s linear 0.3s,opacity 0.3s linear;
188
+ transition:visibility 0s linear 0.3s,opacity 0.3s linear;
189
+ }
190
+ /* Fullscreen options, very important ^^ */
191
+ &.rtFullscreen {
192
+ position: fixed !important;
193
+ height: auto !important;
194
+ width: auto !important;
195
+ margin: 0 !important;
196
+ padding: 0 !important;
197
+ z-index: 2147483647 !important;
198
+ top: 0 !important;
199
+ left: 0 !important;
200
+ bottom: 0 !important;
201
+ right: 0 !important;
202
+ }
203
+ }
204
+ .rtWebkit3d {
205
+ .rtViewport,
206
+ .rtContainer,
207
+ .rtPreloader,
208
+ img,
209
+ .rtArrow,
210
+ .rtControllerToobar {
211
+ -webkit-backface-visibility: hidden;
212
+ -webkit-transform: translateZ(0);
213
+ }
214
+ .rtFade .rtSlide,
215
+ .rtFade img,
216
+ .rtFade .rtContainer {
217
+ -webkit-transform: none;
218
+ }
219
+ }
@@ -0,0 +1,75 @@
1
+ .markregion {
2
+ position: relative;
3
+
4
+ .markregion-view {
5
+ display: none;
6
+
7
+ position: absolute;
8
+ bottom: 0;
9
+ left: 0;
10
+ right: 0;
11
+ top: 0;
12
+ }
13
+ .markregion-area {
14
+ position: absolute;
15
+
16
+ i {
17
+ color: #f5f5f5;
18
+ font-size: 24px;
19
+ }
20
+
21
+ .markregion-note {
22
+ background: #E7FFE7 none repeat scroll 0 0;
23
+ border: solid 1px #397F39;
24
+ color: #000;
25
+ display: none;
26
+ font-family: Verdana, Sans-Serif;
27
+ font-size: 12px;
28
+ // max-width: 200px;
29
+ padding: 3px 7px;
30
+ // position: absolute;
31
+
32
+ .actions {
33
+ display: block;
34
+ font-size: 80%;
35
+ }
36
+ }
37
+
38
+ &:hover .markregion-note { display: block; }
39
+
40
+ // div {
41
+ // border: 2px solid rgba(255, 255, 255, 0.8);
42
+ // display: block;
43
+ // width: 30px;
44
+ // height: 30px;
45
+ // }
46
+ }
47
+ .markregion-area-editable {
48
+ cursor: pointer;
49
+ }
50
+ .markregion-edit {
51
+ display: none;
52
+ }
53
+
54
+ // &:hover {
55
+ // .markregion-view { display: block; }
56
+ // }
57
+ }
58
+ /* Form de edição */
59
+ .markregion-edit-form {
60
+ background: #FFFEE3 none repeat scroll 0 0;
61
+ border: 1px solid #f5f5f5;
62
+ // height: 78px;
63
+ padding: 7px;
64
+ position: absolute;
65
+ width: 250px;
66
+
67
+ form {
68
+ clear: right;
69
+ margin: 0 !important;
70
+ padding: 0;
71
+ z-index: 999;
72
+ }
73
+
74
+ .box { margin: 0; }
75
+ }
@@ -1,212 +1,5 @@
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
- }
1
+ body,
2
+ body.active_admin {
3
+ @import "tours/markregion";
4
+ @import "tours/landscape";
212
5
  }
@@ -0,0 +1,70 @@
1
+ class MarcationsController < ApplicationController
2
+ before_filter :load_tour
3
+ load_and_authorize_resource
4
+ respond_to :html, :json, :js
5
+
6
+ # GET /marcations
7
+ # GET /marcations.json
8
+ def index
9
+ @marcations = @tour.marcations
10
+ respond_with @marcations
11
+ end
12
+
13
+ # GET /marcations/1
14
+ # GET /marcations/1.json
15
+ def show
16
+ @marcation = @tour.marcations.find(params[:id])
17
+ respond_with @marcation
18
+ end
19
+
20
+ # GET /marcations/new
21
+ # GET /marcations/new.json
22
+ def new
23
+ @marcation = @tour.marcations.create params[:marcation]
24
+ respond_with @marcation
25
+ end
26
+
27
+ # GET /marcations/1/edit
28
+ def edit
29
+ @marcation = @tour.marcations.find(params[:id])
30
+ respond_with @marcation
31
+ end
32
+
33
+ # POST /marcations
34
+ # POST /marcations.json
35
+ def create
36
+ @marcation = @tour.marcations.create(params[:marcation])
37
+ # if @marcation.save
38
+ # flash[:notice] = "Marcation was successfully created."
39
+ # end
40
+ respond_with @marcation
41
+ end
42
+
43
+ # PUT /marcations/1
44
+ # PUT /marcations/1.json
45
+ def update
46
+ @marcation = @tour.marcations.find(params[:id])
47
+
48
+ if @marcation.update_attributes(params[:marcation])
49
+ flash[:notice] = "Marcation was successfully updated."
50
+ end
51
+ respond_with @marcation
52
+ # respond_with @marcation do |format|
53
+ # format.json { render json: @marcation }
54
+ # end
55
+ end
56
+
57
+ # DELETE /marcations/1
58
+ # DELETE /marcations/1.json
59
+ def destroy
60
+ @marcation = @tour.marcations.find(params[:id])
61
+ @marcation.destroy
62
+ # flash[:notice] = "Marcation was successfully destroyed."
63
+ respond_with @marcation
64
+ end
65
+
66
+ private
67
+ def load_tour
68
+ @tour = Tour.find params[:tour_id]
69
+ end
70
+ end
File without changes
@@ -0,0 +1,38 @@
1
+ class Marcation < ActiveRecord::Base
2
+ extend ActiveModel::Naming
3
+
4
+ belongs_to :tour
5
+ attr_accessible :body, :left, :top, :url,
6
+ # I18n
7
+ :locale, :translations_attributes
8
+
9
+ # Translate
10
+ translates :body, :url
11
+ accepts_nested_attributes_for :translations
12
+
13
+ class Translation
14
+ attr_accessible :locale, :body, :url
15
+ end
16
+ def translations_attributes=(attributes)
17
+ new_translations = attributes.values.reduce({}) do |new_values, translation|
18
+ new_values.merge! translation.delete("locale") => translation
19
+ end
20
+ set_translations new_translations
21
+ end
22
+
23
+
24
+ include Rails.application.routes.url_helpers
25
+ # include ActionView::Helpers::NumberHelper
26
+
27
+ def as_json options
28
+ # if can? :update, self
29
+ super.merge!(
30
+ path: {
31
+ show: tour_marcation_path(self.tour, self),
32
+ edit: edit_tour_marcation_path(self.tour, self)
33
+ })
34
+ # else
35
+ # super
36
+ # end
37
+ end
38
+ end
data/app/models/tour.rb CHANGED
@@ -7,6 +7,8 @@ class Tour < ActiveRecord::Base
7
7
  # Taggings
8
8
  acts_as_taggable
9
9
 
10
+ has_many :marcations
11
+
10
12
  has_attached_file :tour,
11
13
  :styles => {
12
14
  :thumb => "560x180#"
File without changes
@@ -38,4 +38,40 @@
38
38
  <%= s.body.html_safe if s.body %>
39
39
  </div>
40
40
  </div>
41
+
42
+ <script type="text/javascript" charset="utf-8">
43
+ var Tour_labels = {
44
+ index : '<%= I18n.t "attributes_all.index" %>',
45
+ rotate_left : '<%= I18n.t "attributes_all.rotate_left" %>',
46
+ rotate_right : '<%= I18n.t "attributes_all.rotate_right" %>',
47
+ play_stop : '<%= I18n.t "attributes_all.play_stop" %>',
48
+ zoom : '<%= I18n.t "attributes_all.zoom" %>',
49
+ };
50
+ </script>
51
+
52
+ <%= stylesheet_link_tag "tours" %>
53
+ <%= javascript_include_tag "tours" %>
54
+
55
+ <script language="javascript">
56
+ $(window).load(function() {
57
+ $(".annotate-image").annotateImage({
58
+ useAjax: false
59
+ , editable: true
60
+ , notes: [ { "top": 286,
61
+ "left": 161,
62
+ "width": 30,
63
+ "height": 30,
64
+ "text": "Small people on the steps",
65
+ "id": "e69213d0-2eef-40fa-a04b-0ed998f9f1f5",
66
+ "editable": false },
67
+ { "top": 134,
68
+ "left": 179,
69
+ "width": 30,
70
+ "height": 30,
71
+ "text": "National Gallery Dome",
72
+ "id": "e7f44ac5-bcf2-412d-b440-6dbb8b19ffbe",
73
+ "editable": true } ]
74
+ });
75
+ });
76
+ </script>
41
77
  </div>
@@ -0,0 +1,34 @@
1
+ <%= form_for [@tour, @marcation], html: { class: "form-horizontal " } do |f| %>
2
+ <div class="modal-body">
3
+ <% if @marcation.errors.any? %>
4
+ <div id="error_explanation">
5
+ <h2><%= pluralize(@marcation.errors.count, "error") %> prohibited this marcation from being saved:</h2>
6
+
7
+ <ul>
8
+ <% @marcation.errors.full_messages.each do |msg| %>
9
+ <li><%= msg %></li>
10
+ <% end %>
11
+ </ul>
12
+ </div>
13
+ <% end %>
14
+ <div class="hidden">
15
+ <%= f.hidden_field :top %>
16
+ <%= f.hidden_field :left %>
17
+ </div>
18
+
19
+ <%= f.globalize_inputs :translations do |lf| %>
20
+ <div class="control-group">
21
+ <%= lf.text_field :body, class: 'text_field', placeholder: t(".body") %>
22
+ </div>
23
+ <div class="control-group">
24
+ <%= lf.text_field :url, class: 'text_field', placeholder: t(".url") %>
25
+ </div>
26
+ <%= lf.hidden_field :locale %>
27
+ <% end %>
28
+
29
+ <div class="actions">
30
+ <%= f.button t(".save"), type: :submit, class: "btn btn-primary" %>
31
+ <%= link_to t('.delete'), tour_marcation_path(@tour, @marcation), method: :delete, remote: true, class: "btn btn-danger" %>
32
+ </div>
33
+ </div>
34
+ <% end %>
@@ -0,0 +1 @@
1
+ $("#markregion-modal").modal("hide");
@@ -0,0 +1,2 @@
1
+ $("#<%= @marcation.id %>.markregion-area, .markregion-area.markregion-area-new").remove();
2
+ $("#markregion-modal").modal("hide");
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
File without changes
@@ -4,7 +4,7 @@
4
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
5
  <% end -%>
6
6
 
7
- <%= image_tag @tour.tour, class: "panorama" %>
7
+ <%= image_tag @tour.tour, class: "panorama", alt: "" %>
8
8
 
9
9
  <script type="text/javascript" charset="utf-8">
10
10
  var Tour_labels = {
@@ -23,14 +23,21 @@
23
23
  $(function () {
24
24
  // Initialize the jQuery File Upload widget:
25
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 ) %>
26
+ navBarContainer: "footer .navbar:first > .navbar-inner > .container"
27
+ , data_placement: "top"
28
+ , path: {
29
+ index : "<%= tour_marcations_path(@tour) %>"
30
+ <%= ", new : '#{new_tour_marcation_path(@tour)}'".html_safe if can?(:create, Marcation) %>
31
+ }
32
+ , locale: "<%= I18n.locale %>"
33
+ <%= ", editable : #{can?(:update, @tour)}".html_safe %>
34
+ <%#= ", editable : #{user_signed_in?}".html_safe %>
35
+ <%= ", speed : #{@tour.speed}".html_safe if defined?(@tour.speed ) %>
36
+ <%= ", direction : '#{@tour.direction}'".html_safe if defined?(@tour.direction ) %>
37
+ <%= ", control_display : #{@tour.control_display}".html_safe if defined?(@tour.control_display ) %>
38
+ <%= ", start_position : #{@tour.start_position}".html_safe if defined?(@tour.start_position ) %>
39
+ <%= ", auto_start : #{@tour.auto_start}".html_safe if defined?(@tour.auto_start ) %>
40
+ <%= ", mode_360 : #{@tour.loop}".html_safe if defined?(@tour.loop ) %>
34
41
  });
35
42
  });
36
43
  </script>
@@ -1,5 +1,5 @@
1
1
  class CreateTours < ActiveRecord::Migration
2
- def change
2
+ def up
3
3
  create_table :tours do |t|
4
4
  t.string :slug
5
5
  t.string :name
@@ -0,0 +1,21 @@
1
+ class CreateMarcations < ActiveRecord::Migration
2
+ def up
3
+ create_table :marcations do |t|
4
+ t.belongs_to :tour
5
+ t.integer :top
6
+ t.integer :left
7
+ t.string :body
8
+ t.text :url
9
+
10
+ t.timestamps
11
+ end
12
+ add_index :marcations, :tour_id
13
+
14
+ Marcation.create_translation_table! :body => :string, :url => :text
15
+ end
16
+
17
+ def dow
18
+ drop_table :marcations
19
+ Marcation.drop_translation_table!
20
+ end
21
+ end
File without changes
@@ -1,3 +1,3 @@
1
1
  module RdcmsTour
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/rdcms_tour.rb CHANGED
File without changes
data/rdcms_tour.gemspec CHANGED
File without changes
data/script/rails CHANGED
File without changes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdcms_tour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gullit Miranda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-03 00:00:00.000000000 Z
11
+ date: 2013-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,15 +66,27 @@ files:
66
66
  - README.md
67
67
  - Rakefile
68
68
  - admin/tours.rb
69
- - app/assets/javascripts/tours.js.coffee
69
+ - app/assets/javascripts/tour/landscape.js.coffee
70
+ - app/assets/javascripts/tour/rd.markregion.js.coffee
71
+ - app/assets/javascripts/tours.js
70
72
  - app/assets/stylesheets/tours.css.scss
73
+ - app/assets/stylesheets/tours/landscape.css.scss
74
+ - app/assets/stylesheets/tours/markregion.css.scss
75
+ - app/controllers/marcations_controller.rb
71
76
  - app/controllers/tours_controller.rb
77
+ - app/models/marcation.rb
72
78
  - app/models/tour.rb
73
79
  - app/views/admin/tours/_form.html.erb
74
80
  - app/views/admin/tours/_show.html.erb
81
+ - app/views/marcations/_form.html.erb
82
+ - app/views/marcations/create.js.erb
83
+ - app/views/marcations/destroy.js.erb
84
+ - app/views/marcations/edit.html.erb
85
+ - app/views/marcations/new.html.erb
75
86
  - app/views/tours/index.html.erb
76
87
  - app/views/tours/show.html.erb
77
88
  - db/migrate/20130603134344_create_tours.rb
89
+ - db/migrate/20130720154434_create_marcations.rb
78
90
  - lib/rdcms_tour.rb
79
91
  - lib/rdcms_tour/engine.rb
80
92
  - lib/rdcms_tour/version.rb
@@ -100,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
112
  version: '0'
101
113
  requirements: []
102
114
  rubyforge_project:
103
- rubygems_version: 2.0.2
115
+ rubygems_version: 2.0.3
104
116
  signing_key:
105
117
  specification_version: 4
106
118
  summary: Módulo de Panorâmas para o RDCMS