waterfall_bourbon_neat_rails 0.1.9.8.1 → 0.1.9.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a385e53811c84c32d3ece6ced702f821ca1d6905
|
4
|
+
data.tar.gz: e877f03e3aa077b5a65594639b0f425ba7d9370a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96e26a5fe86ec361b3f692e742e27b1bd149bd6b88976aa5dbe96f54fcec471edda299f74d18d62eba83e3de0453da77c2b40457a2eff312ea5a48f66c8c62d9
|
7
|
+
data.tar.gz: 0866845396e9f7a1c642a568f1411ff6553a306d6fe36aa82e170ee2770785adeb6f7f9a7f24183838910afd37547bcbed70459584d1784f7bfb393dccde58d1
|
@@ -0,0 +1,103 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
//type: error, question, information
|
4
|
+
//options: can contain id for component which use this dialog
|
5
|
+
//options: can contain parent id where will append the dialog template(mandatory)
|
6
|
+
//options: can contain a map object which overwrite the dialog content;
|
7
|
+
// ex:{information:text, question: text, error: text }(optional)
|
8
|
+
var Dialog = function(type, options){
|
9
|
+
this.$template;
|
10
|
+
this.messages = {
|
11
|
+
information: "Information",
|
12
|
+
error: "This is an error",
|
13
|
+
question: "You sure you want to delet this?"
|
14
|
+
}
|
15
|
+
this.config = {};
|
16
|
+
|
17
|
+
this.setConfig = function(){
|
18
|
+
if(!options)
|
19
|
+
alert("dialog with incorrect params");
|
20
|
+
this.config = {
|
21
|
+
parentID: (options.parentID) ? options.parentID : alert("parent ID is missing"),
|
22
|
+
creatorID: (options.creatorID) ? options.creatorID : alert("creator ID is missing")
|
23
|
+
}
|
24
|
+
|
25
|
+
if(options.map){
|
26
|
+
this.config.messages = {
|
27
|
+
information: (options.map.information) ? options.map.information : this.messages.information,
|
28
|
+
error: (options.map.error) ? options.map.error : this.messages.error,
|
29
|
+
question: (options.map.question) ? options.map.question : this.messages.question
|
30
|
+
}
|
31
|
+
}else{
|
32
|
+
this.config.messages = this.messages;
|
33
|
+
}
|
34
|
+
|
35
|
+
return this;
|
36
|
+
}
|
37
|
+
|
38
|
+
this.createTemplate = function(){
|
39
|
+
this.$template = $("<div>").addClass("dialog-wrapper")
|
40
|
+
.append($("<div>")
|
41
|
+
.addClass("dialog-content")
|
42
|
+
.append($("<h1>").addClass("dialog-content-title").text(type.toUpperCase()))
|
43
|
+
.append($("<p>").addClass("dialog-content-text").html((type) ? this.config.messages[type] : "").css("margin-top","20px"))
|
44
|
+
.append($("<div>")
|
45
|
+
.addClass("dialog-content-buttons")
|
46
|
+
.css("margin-top","20px")
|
47
|
+
.append(
|
48
|
+
$("<div>").addClass("dialog-button button-ok")
|
49
|
+
.text("OK")
|
50
|
+
.attr("data-action", "true")
|
51
|
+
)
|
52
|
+
.append(
|
53
|
+
$("<div>").addClass("dialog-button button-cancel")
|
54
|
+
.text("Cancel")
|
55
|
+
.attr("data-action", "false")
|
56
|
+
)
|
57
|
+
)
|
58
|
+
)
|
59
|
+
|
60
|
+
return this;
|
61
|
+
}
|
62
|
+
|
63
|
+
this.addTemplate = function(){
|
64
|
+
$("#"+this.config.parentID).append(this.$template);
|
65
|
+
}
|
66
|
+
|
67
|
+
this.addEventListeners = function(){
|
68
|
+
var self = this;
|
69
|
+
|
70
|
+
this.$template.find(".dialog-content-buttons").on("click", ".dialog-button", function(){
|
71
|
+
var target = $(this).attr("data-action");
|
72
|
+
|
73
|
+
if(target === "true"){
|
74
|
+
var ev = new $.Event("dialog_response", {response: true})
|
75
|
+
}else{
|
76
|
+
var ev = new $.Event("dialog_response", {response: false})
|
77
|
+
}
|
78
|
+
|
79
|
+
$("#"+self.config.creatorID).trigger(ev);
|
80
|
+
self.hide();
|
81
|
+
})
|
82
|
+
|
83
|
+
return this;
|
84
|
+
}
|
85
|
+
|
86
|
+
this.show = function(){
|
87
|
+
this.$template.fadeIn(200);
|
88
|
+
|
89
|
+
return this;
|
90
|
+
}
|
91
|
+
|
92
|
+
this.hide = function(){
|
93
|
+
this.$template.fadeOut(500);
|
94
|
+
|
95
|
+
return this;
|
96
|
+
}
|
97
|
+
|
98
|
+
this.init = function(){
|
99
|
+
this.setConfig().createTemplate().addEventListeners().addTemplate();
|
100
|
+
|
101
|
+
return this;
|
102
|
+
}
|
103
|
+
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: waterfall_bourbon_neat_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.9.
|
4
|
+
version: 0.1.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Waterfall Software Inc.
|
@@ -203,6 +203,7 @@ files:
|
|
203
203
|
- app/assets/images/waterfall_bourbon_neat_rails/home-bg.jpg
|
204
204
|
- app/assets/images/waterfall_bourbon_neat_rails/home-tile-bg.gif
|
205
205
|
- app/assets/images/waterfall_bourbon_neat_rails/waterfall-software-logo.png
|
206
|
+
- app/assets/javascripts/dialog.js
|
206
207
|
- app/assets/javascripts/waterfall_bourbon_neat_rails.js
|
207
208
|
- app/assets/javascripts/waterfall_bourbon_neat_rails/application.js
|
208
209
|
- app/assets/stylesheets/base/_base.scss
|