help-anywhere 0.1.4 → 0.1.5
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.
- data/app/assets/javascripts/help_anywhere/components/bubble.js.coffee +33 -9
- data/app/assets/javascripts/help_anywhere/help_anywhere.js.coffee +2 -4
- data/app/assets/stylesheets/help_anywhere_core_only.css.scss +3 -1
- data/app/controllers/help_anywhere/base_controller.rb +2 -1
- data/lib/help-anywhere/version.rb +1 -1
- data/lib/tasks/help-anywhere_tasks.rake +4 -5
- data/test/dummy/log/test.log +3 -0
- metadata +3 -3
@@ -18,13 +18,14 @@ do ( $ = jQuery ) ->
|
|
18
18
|
if (id = elm.attr('id'))?
|
19
19
|
return "##{id}"
|
20
20
|
|
21
|
-
selector = elm.parents().toArray()
|
21
|
+
selector = elm.parents()[0..-2].toArray()
|
22
22
|
.map (x) ->
|
23
23
|
out = x.tagName
|
24
24
|
if (id = $(x).attr('id'))?
|
25
25
|
out += "##{id}"
|
26
26
|
if (classes = $(x).attr('class'))? and classes isnt ''
|
27
27
|
out += classes.split(/\s/g).map((x)-> '.' + x).join()
|
28
|
+
out += ":nth-child(#{$(x).index()+1})"
|
28
29
|
return out
|
29
30
|
.reverse()
|
30
31
|
.join('>')
|
@@ -91,7 +92,25 @@ do ( $ = jQuery ) ->
|
|
91
92
|
|
92
93
|
$("html").on 'mousemove', handleMouseMove
|
93
94
|
$("html").on 'mousedown', handleMouseDown
|
95
|
+
###
|
96
|
+
END HTML SELECTION SYSTEM
|
97
|
+
###
|
98
|
+
|
99
|
+
###
|
100
|
+
HANDLING RESIZING
|
101
|
+
###
|
102
|
+
|
103
|
+
$(window).on('scroll resize', ->
|
94
104
|
|
105
|
+
)
|
106
|
+
|
107
|
+
###
|
108
|
+
END HANDLING RESIZING
|
109
|
+
###
|
110
|
+
|
111
|
+
###
|
112
|
+
HTML TEMPLATES FOR ELEMENTS
|
113
|
+
###
|
95
114
|
BUBBLE_TEMPLATE = -> """
|
96
115
|
<div class="ha-bubble-box">
|
97
116
|
<div class="ha-bubble-pointer"></div>
|
@@ -119,6 +138,9 @@ do ( $ = jQuery ) ->
|
|
119
138
|
<input type="button" class="ha-bubble-remove btn btn-danger" value="Remove">
|
120
139
|
</div>
|
121
140
|
"""
|
141
|
+
###
|
142
|
+
END HTML TEMPLATES
|
143
|
+
###
|
122
144
|
|
123
145
|
# Just constants to get named into array for d&d of resize handling
|
124
146
|
X = 0
|
@@ -142,6 +164,8 @@ do ( $ = jQuery ) ->
|
|
142
164
|
build: (editMode) ->
|
143
165
|
@elm = $(BUBBLE_TEMPLATE.call(this))
|
144
166
|
|
167
|
+
@elm.data('_component', this)
|
168
|
+
|
145
169
|
@editMode = editMode
|
146
170
|
|
147
171
|
#Render the handlers for edition mode as needed
|
@@ -240,27 +264,27 @@ do ( $ = jQuery ) ->
|
|
240
264
|
switch finalPosition
|
241
265
|
when 'top'
|
242
266
|
@elm.css
|
243
|
-
top: (boundingBox.y - bubbleSize[1]) + "px"
|
244
|
-
left: boundingBox.x + Math.round((boundingBox.w-bubbleSize[0])/2) + "px"
|
267
|
+
top: Math.max(0, (boundingBox.y - bubbleSize[1])) + "px"
|
268
|
+
left: Math.max(0, boundingBox.x + Math.round((boundingBox.w-bubbleSize[0])/2)) + "px"
|
245
269
|
'margin-top': '-14px'
|
246
270
|
'margin-left': '0px'
|
247
271
|
when 'bottom'
|
248
272
|
@elm.css
|
249
|
-
top: boundingBox.y2 + "px"
|
250
|
-
left: boundingBox.x + Math.round((boundingBox.w-bubbleSize[0])/2) + "px"
|
273
|
+
top: Math.max(0, boundingBox.y2) + "px"
|
274
|
+
left: Math.max(0, boundingBox.x + Math.round((boundingBox.w-bubbleSize[0])/2)) + "px"
|
251
275
|
'margin-top': '14px'
|
252
276
|
'margin-left': '0px'
|
253
277
|
when 'right'
|
254
278
|
@elm.css
|
255
|
-
top: boundingBox.y + Math.round((boundingBox.h-bubbleSize[1])/2) + "px"
|
256
|
-
left: boundingBox.x2 + "px"
|
279
|
+
top: Math.max(0, boundingBox.y + Math.round((boundingBox.h-bubbleSize[1])/2)) + "px"
|
280
|
+
left: Math.max(0, boundingBox.x2) + "px"
|
257
281
|
'margin-left': '14px'
|
258
282
|
'margin-top': '0px'
|
259
283
|
else
|
260
284
|
@position = 'left'
|
261
285
|
@elm.css
|
262
|
-
top: boundingBox.y + Math.round((boundingBox.h-bubbleSize[1])/2) + "px"
|
263
|
-
left: (boundingBox.x - bubbleSize[0]) + "px"
|
286
|
+
top: Math.max(0, boundingBox.y + Math.round((boundingBox.h-bubbleSize[1])/2)) + "px"
|
287
|
+
left: Math.max(0, (boundingBox.x - bubbleSize[0])) + "px"
|
264
288
|
'margin-left': '-14px'
|
265
289
|
'margin-top': '0px'
|
266
290
|
|
@@ -1,8 +1,7 @@
|
|
1
1
|
do($ = jQuery) ->
|
2
2
|
HELP_TEMPLATE = (args) ->
|
3
3
|
"""
|
4
|
-
<div id="help-anywhere-widget"
|
5
|
-
<div class="ha-std-button" title="Help">?</div>
|
4
|
+
<div id="help-anywhere-widget" title="Help">?
|
6
5
|
</div>
|
7
6
|
"""
|
8
7
|
|
@@ -123,8 +122,7 @@ do($ = jQuery) ->
|
|
123
122
|
buildInterface: ->
|
124
123
|
unless @help?
|
125
124
|
@help = $(HELP_TEMPLATE())
|
126
|
-
@help.
|
127
|
-
@openHelpInterface()
|
125
|
+
@help.on 'click', => @openHelpInterface()
|
128
126
|
@help.css(display: 'block', opacity: '0')
|
129
127
|
.animate(opacity: '1', 2000)
|
130
128
|
.appendTo($('body'))
|
@@ -24,6 +24,8 @@
|
|
24
24
|
font-size: 12px;
|
25
25
|
text-align: center;
|
26
26
|
|
27
|
+
z-index: 10001;
|
28
|
+
|
27
29
|
&:hover {
|
28
30
|
border-color: yellow;
|
29
31
|
color: yellow;
|
@@ -54,7 +56,7 @@
|
|
54
56
|
}
|
55
57
|
|
56
58
|
.ha-edit-bottom-layout {
|
57
|
-
position:
|
59
|
+
position: fixed;
|
58
60
|
bottom: 0;
|
59
61
|
left: 0;
|
60
62
|
background-color: #333;
|
@@ -4,7 +4,8 @@ class HelpAnywhere::BaseController < ApplicationController
|
|
4
4
|
private
|
5
5
|
def check_authentication
|
6
6
|
unless HelpAnywhere.config.has_edition_role? self
|
7
|
-
|
7
|
+
render :text => "You are not authorized to edit help", :status => 403
|
8
|
+
return
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
@@ -1,5 +1,4 @@
|
|
1
1
|
#coding: utf-8
|
2
|
-
require 'colorize'
|
3
2
|
|
4
3
|
namespace :help_anywhere do
|
5
4
|
desc "Generate everything you need to run help-anywhere plugin."
|
@@ -10,7 +9,7 @@ namespace :help_anywhere do
|
|
10
9
|
filepath = File.join Dir.pwd, relpath
|
11
10
|
|
12
11
|
if File.exists?(filepath)
|
13
|
-
puts "[X]
|
12
|
+
puts "[X] Skipping `#{relpath}`: File already exists"
|
14
13
|
else
|
15
14
|
File.write filepath,
|
16
15
|
<<-RUBY
|
@@ -29,7 +28,7 @@ HelpAnywhere.configure do |config|
|
|
29
28
|
# routes.match '/admin/?/*/?...', 'admin_help_for_resource_$1_action_$2'
|
30
29
|
end
|
31
30
|
|
32
|
-
# Set here the method which is called to
|
31
|
+
# Set here the method which is called to alloww or disallow edition mode
|
33
32
|
# You can create this method in your ApplicationController class.
|
34
33
|
# Default is a method which return always true: every one can edit help.
|
35
34
|
#
|
@@ -37,9 +36,9 @@ HelpAnywhere.configure do |config|
|
|
37
36
|
end
|
38
37
|
RUBY
|
39
38
|
|
40
|
-
puts "[»]
|
39
|
+
puts "[»] create `#{relpath}`"
|
41
40
|
end
|
42
41
|
|
43
|
-
puts "[»]
|
42
|
+
puts "[»] Done! please add `require help_anywhere` in both application.js and application.css, run migrations, enjoy!"
|
44
43
|
end
|
45
44
|
end
|
data/test/dummy/log/test.log
CHANGED
@@ -6,3 +6,6 @@ Connecting to database specified by database.yml
|
|
6
6
|
Connecting to database specified by database.yml
|
7
7
|
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
8
8
|
[1m[35m (0.1ms)[0m rollback transaction
|
9
|
+
Connecting to database specified by database.yml
|
10
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
11
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: help-anywhere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -147,7 +147,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
147
147
|
version: '0'
|
148
148
|
segments:
|
149
149
|
- 0
|
150
|
-
hash:
|
150
|
+
hash: -3689506766325585717
|
151
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
152
|
none: false
|
153
153
|
requirements:
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
segments:
|
158
158
|
- 0
|
159
|
-
hash:
|
159
|
+
hash: -3689506766325585717
|
160
160
|
requirements: []
|
161
161
|
rubyforge_project:
|
162
162
|
rubygems_version: 1.8.23
|