familiarity 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +67 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/javascripts/familiarity/application.js +16 -0
  6. data/app/assets/javascripts/familiarity/familiarity.js.erb +193 -0
  7. data/app/assets/javascripts/familiarity/familiarity_admin.js.erb +150 -0
  8. data/app/assets/javascripts/familiarity/jquery.cookie.js +117 -0
  9. data/app/assets/javascripts/familiarity/jquery.tooltipster.js +1282 -0
  10. data/app/assets/stylesheets/familiarity/application.css +17 -0
  11. data/app/assets/stylesheets/familiarity/familiarities.css +4 -0
  12. data/app/assets/stylesheets/familiarity/familiarity.css.scss +121 -0
  13. data/app/assets/stylesheets/familiarity/themes/tooltipster-light.css +12 -0
  14. data/app/assets/stylesheets/familiarity/themes/tooltipster-noir.css +12 -0
  15. data/app/assets/stylesheets/familiarity/themes/tooltipster-punk.css +12 -0
  16. data/app/assets/stylesheets/familiarity/themes/tooltipster-shadow.css +12 -0
  17. data/app/assets/stylesheets/familiarity/tooltipster.css +274 -0
  18. data/app/controllers/familiarity/application_controller.rb +4 -0
  19. data/app/controllers/familiarity/familiarities_controller.rb +22 -0
  20. data/app/helpers/familiarity/application_helper.rb +32 -0
  21. data/app/helpers/familiarity/familiarities_helper.rb +4 -0
  22. data/app/views/familiarity/familiarities/index.json.erb +1 -0
  23. data/app/views/layouts/familiarity/application.html.erb +14 -0
  24. data/config/routes.rb +7 -0
  25. data/lib/familiarity/engine.rb +17 -0
  26. data/lib/familiarity/version.rb +3 -0
  27. data/lib/familiarity.rb +4 -0
  28. data/lib/tasks/familiarity_tasks.rake +4 -0
  29. data/test/controllers/familiarity/familiarities_controller_test.rb +9 -0
  30. data/test/dummy/README.rdoc +28 -0
  31. data/test/dummy/Rakefile +6 -0
  32. data/test/dummy/app/assets/javascripts/application.js +13 -0
  33. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  34. data/test/dummy/app/controllers/application_controller.rb +5 -0
  35. data/test/dummy/app/helpers/application_helper.rb +2 -0
  36. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  37. data/test/dummy/bin/bundle +3 -0
  38. data/test/dummy/bin/rails +4 -0
  39. data/test/dummy/bin/rake +4 -0
  40. data/test/dummy/config/application.rb +23 -0
  41. data/test/dummy/config/boot.rb +5 -0
  42. data/test/dummy/config/database.yml +25 -0
  43. data/test/dummy/config/environment.rb +5 -0
  44. data/test/dummy/config/environments/development.rb +37 -0
  45. data/test/dummy/config/environments/production.rb +78 -0
  46. data/test/dummy/config/environments/test.rb +39 -0
  47. data/test/dummy/config/initializers/assets.rb +8 -0
  48. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  49. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  50. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  51. data/test/dummy/config/initializers/inflections.rb +16 -0
  52. data/test/dummy/config/initializers/mime_types.rb +4 -0
  53. data/test/dummy/config/initializers/session_store.rb +3 -0
  54. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/dummy/config/locales/en.yml +23 -0
  56. data/test/dummy/config/routes.rb +4 -0
  57. data/test/dummy/config/secrets.yml +22 -0
  58. data/test/dummy/config.ru +4 -0
  59. data/test/dummy/public/404.html +67 -0
  60. data/test/dummy/public/422.html +67 -0
  61. data/test/dummy/public/500.html +66 -0
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/familiarity_test.rb +7 -0
  64. data/test/helpers/familiarity/familiarities_helper_test.rb +6 -0
  65. data/test/integration/navigation_test.rb +10 -0
  66. data/test/test_helper.rb +15 -0
  67. metadata +176 -0
@@ -0,0 +1,17 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require ../familiarity/tooltipster
14
+ *= require_directory ../familiarity/themes
15
+ *= require_tree .
16
+ *= require_self
17
+ */
@@ -0,0 +1,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,121 @@
1
+ .familiaritySwitch {
2
+
3
+ /*gradient*/
4
+ background: #666666; /* old browsers */
5
+ background: -moz-linear-gradient(top, #666666 4%, #545454 50%, #3A3A3A 51%, #131313 100%); /* firefox */
6
+
7
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(4%, #666666), color-stop(50%, #545454), color-stop(51%, #3A3A3A), color-stop(100%, #131313)); /* webkit */
8
+
9
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#666666', endColorstr='#131313', GradientType=0); /* ie */
10
+
11
+ border-radius: 15px;
12
+ bottom: 10px;
13
+ right: 10px;
14
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.8);
15
+ cursor: pointer;
16
+ height: 30px;
17
+ position: fixed;
18
+ width: 180px;
19
+ z-index: 1000;
20
+
21
+ .text_content {
22
+ color: #eeeeee;
23
+ font-family: Helvetica, sans-serif;
24
+ font-size: 14px;
25
+ font-weight: bold;
26
+ line-height: 30px;
27
+ text-align: center;
28
+ text-shadow: 3px 3px 1px rgba(0, 0, 0, 0.96);
29
+ }
30
+ }
31
+
32
+ //.familiaritySwitch {
33
+ // background-color: white;
34
+ // border-color: #787878;
35
+ // border-radius: 12px 12px 0 0;
36
+ // border-style: solid solid none;
37
+ // border-width: 4px;
38
+ // font-size: 13px;
39
+ // padding: 5px;
40
+ // position: fixed;
41
+ // right: 10px;
42
+ // bottom: 0;
43
+ // z-index: 1000;
44
+ // text-shadow: 0 2px 2px #777777;
45
+ // cursor: pointer;
46
+ //}
47
+
48
+ .familiar-selector {
49
+ border: 1px dotted #000 !important;
50
+ // background-color: blue;
51
+ // opacity: 0.5;
52
+ }
53
+
54
+ .familiarityPopUpEdit {
55
+
56
+ .textarea_class {
57
+ border: 5px solid #ccc;
58
+ border-radius: 13px;
59
+ font-family: verdana;
60
+ font-size: 10px;
61
+ min-height: 100px;
62
+ padding: 5px;
63
+ width: 350px;
64
+ background-color: #eef0f0;
65
+ margin: 0;
66
+ &:focus {
67
+ border: 5px solid #ccc;
68
+ border-radius: 13px;
69
+ font-family: verdana;
70
+ font-size: 10px;
71
+ min-height: 100px;
72
+ padding: 5px;
73
+ width: 350px;
74
+ background-color: #fff;
75
+ }
76
+ }
77
+ .a_class {
78
+ background-color: #777777;
79
+ border: 5px solid #ccc;
80
+ border-radius: 10px;
81
+ color: #fff;
82
+ cursor: pointer;
83
+ font-size: 8px;
84
+ font-weight: bold;
85
+ left: 295px;
86
+ padding: 5px;
87
+ position: relative;
88
+ text-transform: uppercase;
89
+ top: -123px;
90
+ margin: 0;
91
+ &:hover {
92
+ color: #fff !important;
93
+ }
94
+ }
95
+ }
96
+
97
+ .familiarity-view {
98
+
99
+ #familiarity_dim {
100
+ background-color: black;
101
+ height: 100%;
102
+ left: 0;
103
+ opacity: 0.8;
104
+ position: fixed;
105
+ top: 0;
106
+ width: 100%;
107
+ z-index: 900;
108
+ }
109
+
110
+ .familiarity-bubble-parent {
111
+ // background-color: #b9b9b9 !important;
112
+ // border: 3px solid #ffffff !important;
113
+ // border-radius: 10px !important;
114
+ // padding: 5px !important;
115
+ position: relative;
116
+ z-index: 950;
117
+ -webkit-box-shadow: 0px 0px 10px 5px rgba(0, 0, 0, 1);
118
+ -moz-box-shadow: 0px 0px 10px 5px rgba(0, 0, 0, 1);
119
+ box-shadow: 0px 0px 10px 5px rgba(0, 0, 0, 1);
120
+ }
121
+ }
@@ -0,0 +1,12 @@
1
+ .tooltipster-light {
2
+ border-radius: 5px;
3
+ border: 1px solid #cccccc;
4
+ background: #ededed;
5
+ color: #666666;
6
+ }
7
+ .tooltipster-light .tooltipster-content {
8
+ font-family: Arial, sans-serif;
9
+ font-size: 14px;
10
+ line-height: 16px;
11
+ padding: 8px 10px;
12
+ }
@@ -0,0 +1,12 @@
1
+ .tooltipster-noir {
2
+ border-radius: 0px;
3
+ border: 3px solid #2c2c2c;
4
+ background: #fff;
5
+ color: #2c2c2c;
6
+ }
7
+ .tooltipster-noir .tooltipster-content {
8
+ font-family: 'Georgia', serif;
9
+ font-size: 14px;
10
+ line-height: 16px;
11
+ padding: 8px 10px;
12
+ }
@@ -0,0 +1,12 @@
1
+ .tooltipster-punk {
2
+ border-radius: 5px;
3
+ border-bottom: 3px solid #f71169;
4
+ background: #2a2a2a;
5
+ color: #fff;
6
+ }
7
+ .tooltipster-punk .tooltipster-content {
8
+ font-family: 'Courier', monospace;
9
+ font-size: 14px;
10
+ line-height: 16px;
11
+ padding: 8px 10px;
12
+ }
@@ -0,0 +1,12 @@
1
+ .tooltipster-shadow {
2
+ border-radius: 5px;
3
+ background: #fff;
4
+ box-shadow: 0px 0px 14px rgba(0,0,0,0.3);
5
+ color: #2c2c2c;
6
+ }
7
+ .tooltipster-shadow .tooltipster-content {
8
+ font-family: 'Arial', sans-serif;
9
+ font-size: 14px;
10
+ line-height: 16px;
11
+ padding: 8px 10px;
12
+ }
@@ -0,0 +1,274 @@
1
+ /* This is the default Tooltipster theme (feel free to modify or duplicate and create multiple themes!): */
2
+ .tooltipster-default {
3
+ border-radius: 5px;
4
+ border: 2px solid #000;
5
+ background: #4c4c4c;
6
+ color: #fff;
7
+ }
8
+
9
+ /* Use this next selector to style things like font-size and line-height: */
10
+ .tooltipster-default .tooltipster-content {
11
+ font-family: Arial, sans-serif;
12
+ font-size: 14px;
13
+ line-height: 16px;
14
+ padding: 8px 10px;
15
+ overflow: hidden;
16
+ }
17
+
18
+ /* This next selector defines the color of the border on the outside of the arrow. This will automatically match the color and size of the border set on the main tooltip styles. Set display: none; if you would like a border around the tooltip but no border around the arrow */
19
+ .tooltipster-default .tooltipster-arrow .tooltipster-arrow-border {
20
+ /* border-color: ... !important; */
21
+ }
22
+
23
+
24
+ /* If you're using the icon option, use this next selector to style them */
25
+ .tooltipster-icon {
26
+ cursor: help;
27
+ margin-left: 4px;
28
+ }
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+ /* This is the base styling required to make all Tooltipsters work */
38
+ .tooltipster-base {
39
+ padding: 0;
40
+ font-size: 0;
41
+ line-height: 0;
42
+ position: absolute;
43
+ left: 0;
44
+ top: 0;
45
+ z-index: 9999999;
46
+ pointer-events: none;
47
+ width: auto;
48
+ overflow: visible;
49
+ }
50
+ .tooltipster-base .tooltipster-content {
51
+ overflow: hidden;
52
+ }
53
+
54
+
55
+ /* These next classes handle the styles for the little arrow attached to the tooltip. By default, the arrow will inherit the same colors and border as what is set on the main tooltip itself. */
56
+ .tooltipster-arrow {
57
+ display: block;
58
+ text-align: center;
59
+ width: 100%;
60
+ height: 100%;
61
+ position: absolute;
62
+ top: 0;
63
+ left: 0;
64
+ z-index: -1;
65
+ }
66
+ .tooltipster-arrow span, .tooltipster-arrow-border {
67
+ display: block;
68
+ width: 0;
69
+ height: 0;
70
+ position: absolute;
71
+ }
72
+ .tooltipster-arrow-top span, .tooltipster-arrow-top-right span, .tooltipster-arrow-top-left span {
73
+ border-left: 8px solid transparent !important;
74
+ border-right: 8px solid transparent !important;
75
+ border-top: 8px solid;
76
+ bottom: -7px;
77
+ }
78
+ .tooltipster-arrow-top .tooltipster-arrow-border, .tooltipster-arrow-top-right .tooltipster-arrow-border, .tooltipster-arrow-top-left .tooltipster-arrow-border {
79
+ border-left: 9px solid transparent !important;
80
+ border-right: 9px solid transparent !important;
81
+ border-top: 9px solid;
82
+ bottom: -7px;
83
+ }
84
+
85
+ .tooltipster-arrow-bottom span, .tooltipster-arrow-bottom-right span, .tooltipster-arrow-bottom-left span {
86
+ border-left: 8px solid transparent !important;
87
+ border-right: 8px solid transparent !important;
88
+ border-bottom: 8px solid;
89
+ top: -7px;
90
+ }
91
+ .tooltipster-arrow-bottom .tooltipster-arrow-border, .tooltipster-arrow-bottom-right .tooltipster-arrow-border, .tooltipster-arrow-bottom-left .tooltipster-arrow-border {
92
+ border-left: 9px solid transparent !important;
93
+ border-right: 9px solid transparent !important;
94
+ border-bottom: 9px solid;
95
+ top: -7px;
96
+ }
97
+ .tooltipster-arrow-top span, .tooltipster-arrow-top .tooltipster-arrow-border, .tooltipster-arrow-bottom span, .tooltipster-arrow-bottom .tooltipster-arrow-border {
98
+ left: 0;
99
+ right: 0;
100
+ margin: 0 auto;
101
+ }
102
+ .tooltipster-arrow-top-left span, .tooltipster-arrow-bottom-left span {
103
+ left: 6px;
104
+ }
105
+ .tooltipster-arrow-top-left .tooltipster-arrow-border, .tooltipster-arrow-bottom-left .tooltipster-arrow-border {
106
+ left: 5px;
107
+ }
108
+ .tooltipster-arrow-top-right span, .tooltipster-arrow-bottom-right span {
109
+ right: 6px;
110
+ }
111
+ .tooltipster-arrow-top-right .tooltipster-arrow-border, .tooltipster-arrow-bottom-right .tooltipster-arrow-border {
112
+ right: 5px;
113
+ }
114
+ .tooltipster-arrow-left span, .tooltipster-arrow-left .tooltipster-arrow-border {
115
+ border-top: 8px solid transparent !important;
116
+ border-bottom: 8px solid transparent !important;
117
+ border-left: 8px solid;
118
+ top: 50%;
119
+ margin-top: -7px;
120
+ right: -7px;
121
+ }
122
+ .tooltipster-arrow-left .tooltipster-arrow-border {
123
+ border-top: 9px solid transparent !important;
124
+ border-bottom: 9px solid transparent !important;
125
+ border-left: 9px solid;
126
+ margin-top: -8px;
127
+ }
128
+ .tooltipster-arrow-right span, .tooltipster-arrow-right .tooltipster-arrow-border {
129
+ border-top: 8px solid transparent !important;
130
+ border-bottom: 8px solid transparent !important;
131
+ border-right: 8px solid;
132
+ top: 50%;
133
+ margin-top: -7px;
134
+ left: -7px;
135
+ }
136
+ .tooltipster-arrow-right .tooltipster-arrow-border {
137
+ border-top: 9px solid transparent !important;
138
+ border-bottom: 9px solid transparent !important;
139
+ border-right: 9px solid;
140
+ margin-top: -8px;
141
+ }
142
+
143
+
144
+ /* Some CSS magic for the awesome animations - feel free to make your own custom animations and reference it in your Tooltipster settings! */
145
+
146
+ .tooltipster-fade {
147
+ opacity: 0;
148
+ -webkit-transition-property: opacity;
149
+ -moz-transition-property: opacity;
150
+ -o-transition-property: opacity;
151
+ -ms-transition-property: opacity;
152
+ transition-property: opacity;
153
+ }
154
+ .tooltipster-fade-show {
155
+ opacity: 1;
156
+ }
157
+
158
+ .tooltipster-grow {
159
+ -webkit-transform: scale(0,0);
160
+ -moz-transform: scale(0,0);
161
+ -o-transform: scale(0,0);
162
+ -ms-transform: scale(0,0);
163
+ transform: scale(0,0);
164
+ -webkit-transition-property: -webkit-transform;
165
+ -moz-transition-property: -moz-transform;
166
+ -o-transition-property: -o-transform;
167
+ -ms-transition-property: -ms-transform;
168
+ transition-property: transform;
169
+ -webkit-backface-visibility: hidden;
170
+ }
171
+ .tooltipster-grow-show {
172
+ -webkit-transform: scale(1,1);
173
+ -moz-transform: scale(1,1);
174
+ -o-transform: scale(1,1);
175
+ -ms-transform: scale(1,1);
176
+ transform: scale(1,1);
177
+ -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
178
+ -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
179
+ -moz-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
180
+ -ms-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
181
+ -o-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
182
+ transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
183
+ }
184
+
185
+ .tooltipster-swing {
186
+ opacity: 0;
187
+ -webkit-transform: rotateZ(4deg);
188
+ -moz-transform: rotateZ(4deg);
189
+ -o-transform: rotateZ(4deg);
190
+ -ms-transform: rotateZ(4deg);
191
+ transform: rotateZ(4deg);
192
+ -webkit-transition-property: -webkit-transform, opacity;
193
+ -moz-transition-property: -moz-transform;
194
+ -o-transition-property: -o-transform;
195
+ -ms-transition-property: -ms-transform;
196
+ transition-property: transform;
197
+ }
198
+ .tooltipster-swing-show {
199
+ opacity: 1;
200
+ -webkit-transform: rotateZ(0deg);
201
+ -moz-transform: rotateZ(0deg);
202
+ -o-transform: rotateZ(0deg);
203
+ -ms-transform: rotateZ(0deg);
204
+ transform: rotateZ(0deg);
205
+ -webkit-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 1);
206
+ -webkit-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4);
207
+ -moz-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4);
208
+ -ms-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4);
209
+ -o-transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4);
210
+ transition-timing-function: cubic-bezier(0.230, 0.635, 0.495, 2.4);
211
+ }
212
+
213
+ .tooltipster-fall {
214
+ top: 0;
215
+ -webkit-transition-property: top;
216
+ -moz-transition-property: top;
217
+ -o-transition-property: top;
218
+ -ms-transition-property: top;
219
+ transition-property: top;
220
+ -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
221
+ -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
222
+ -moz-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
223
+ -ms-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
224
+ -o-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
225
+ transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
226
+ }
227
+ .tooltipster-fall-show {
228
+ }
229
+ .tooltipster-fall.tooltipster-dying {
230
+ -webkit-transition-property: all;
231
+ -moz-transition-property: all;
232
+ -o-transition-property: all;
233
+ -ms-transition-property: all;
234
+ transition-property: all;
235
+ top: 0px !important;
236
+ opacity: 0;
237
+ }
238
+
239
+ .tooltipster-slide {
240
+ left: -40px;
241
+ -webkit-transition-property: left;
242
+ -moz-transition-property: left;
243
+ -o-transition-property: left;
244
+ -ms-transition-property: left;
245
+ transition-property: left;
246
+ -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1);
247
+ -webkit-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
248
+ -moz-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
249
+ -ms-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
250
+ -o-transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
251
+ transition-timing-function: cubic-bezier(0.175, 0.885, 0.320, 1.15);
252
+ }
253
+ .tooltipster-slide.tooltipster-slide-show {
254
+ }
255
+ .tooltipster-slide.tooltipster-dying {
256
+ -webkit-transition-property: all;
257
+ -moz-transition-property: all;
258
+ -o-transition-property: all;
259
+ -ms-transition-property: all;
260
+ transition-property: all;
261
+ left: 0px !important;
262
+ opacity: 0;
263
+ }
264
+
265
+
266
+ /* CSS transition for when contenting is changing in a tooltip that is still open. The only properties that will NOT transition are: width, height, top, and left */
267
+ .tooltipster-content-changing {
268
+ opacity: 0.5;
269
+ -webkit-transform: scale(1.1, 1.1);
270
+ -moz-transform: scale(1.1, 1.1);
271
+ -o-transform: scale(1.1, 1.1);
272
+ -ms-transform: scale(1.1, 1.1);
273
+ transform: scale(1.1, 1.1);
274
+ }
@@ -0,0 +1,4 @@
1
+ module Familiarity
2
+ class ApplicationController < ::ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,22 @@
1
+ require 'yaml' # Built in, no gem required
2
+ require_dependency "familiarity/application_controller"
3
+
4
+ module Familiarity
5
+ class FamiliaritiesController < ApplicationController
6
+ before_filter :load_familiarities_yml
7
+
8
+ def index
9
+ end
10
+
11
+ def save
12
+ File.open(@file_path, 'w+') { |f| f.write (@familiarities_hash.merge(params[:from_page] => params[:familiarity_hash])).to_yaml } #Store
13
+ render nothing: true, status: 200
14
+ end
15
+
16
+ private
17
+ def load_familiarities_yml
18
+ @file_path = File.join(Rails.root, 'familiarities.yml')
19
+ @familiarities_hash = ((YAML::load_file(@file_path) rescue nil)|| {})
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,32 @@
1
+ module Familiarity
2
+ module ApplicationHelper
3
+ def familiaritySwitchBoard
4
+ content_tag('script') do
5
+ raw "$(document).on(\"page:change\", function () {FamiliarityAdmin.familiaritySwitchBoard();});"
6
+ end
7
+ end
8
+
9
+ def familiarityView(options={})
10
+ _options= {
11
+ escape_to_exit: true,
12
+ f1_to_start: true,
13
+ show_tips_recursively: false,
14
+ mandatory_all_tips: true,
15
+ traverse_back: true,
16
+ remember_duration: 30 #In Days
17
+ }.merge(options)
18
+
19
+ content_tag('script') do
20
+ raw <<END_SQL
21
+ var cn = 'familiarity_' + '#{request.path}'.replace(/\\//g,'A');
22
+ var familiarity = new Familiarity(#{_options.to_json});
23
+ if (typeof $.cookie(cn) == "undefined")
24
+ {
25
+ familiarity.familiarityView(true);
26
+ console.log($.cookie(cn, new Date(), { expires: #{_options[:remember_duration]} }));
27
+ }
28
+ END_SQL
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,4 @@
1
+ module Familiarity
2
+ module FamiliaritiesHelper
3
+ end
4
+ end
@@ -0,0 +1 @@
1
+ <%== @familiarities_hash.to_json %>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Familiarity</title>
5
+ <%= stylesheet_link_tag "familiarity/application", media: "all" %>
6
+ <%= javascript_include_tag "familiarity/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,7 @@
1
+ Familiarity::Engine.routes.draw do
2
+ resources :familiarities do
3
+ collection do
4
+ post 'save', as: 'save'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ module Familiarity
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Familiarity
4
+
5
+ #initializer 'my_engine.action_controller' do |app|
6
+ # ActiveSupport.on_load :action_controller do
7
+ # helper Familiarity::ApplicationHelper
8
+ # end
9
+ #end
10
+ end
11
+
12
+ class Railtie < ::Rails::Railtie
13
+ initializer "familiarity.view_helpers" do
14
+ ActionView::Base.send :include, Familiarity::ApplicationHelper
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Familiarity
2
+ VERSION = "0.2.1"
3
+ end
@@ -0,0 +1,4 @@
1
+ require "familiarity/engine"
2
+
3
+ module Familiarity
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :familiarity do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,9 @@
1
+ require 'test_helper'
2
+
3
+ module Familiarity
4
+ class FamiliaritiesControllerTest < ActionController::TestCase
5
+ # test "the truth" do
6
+ # assert true
7
+ # end
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */