skvs 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/skvs/version.rb +1 -1
  2. data/lib/views/index.erb +39 -5
  3. metadata +4 -4
data/lib/skvs/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Skvs
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/views/index.erb CHANGED
@@ -1,6 +1,11 @@
1
1
  <html>
2
2
  <head>
3
3
  <style>
4
+
5
+ body {
6
+ margin: 0;
7
+ }
8
+
4
9
  table{
5
10
  border-collapse:separate;
6
11
  border-spacing: 0 20px;
@@ -13,12 +18,18 @@
13
18
  padding: 0 10px;
14
19
  }
15
20
 
21
+ table tfoot td {
22
+ padding: 2px 0;
23
+ border: none;
24
+ background: #ddd;
25
+ }
26
+
16
27
  table tfoot a{
17
28
  text-decoration: underline;
18
29
  }
19
30
 
20
31
  table td{
21
- border-left: 1px solid #eee;
32
+ border-left: 1px solid #ddd;
22
33
  }
23
34
 
24
35
  table th{
@@ -28,7 +39,7 @@
28
39
  }
29
40
 
30
41
  table tr:hover th{
31
- border-right: 1px solid #eee;
42
+ border-right: 1px solid #ddd;
32
43
  }
33
44
 
34
45
  * {
@@ -61,10 +72,16 @@
61
72
  padding: 2px;
62
73
  }
63
74
 
75
+ th.buttons {
76
+ text-align: left;
77
+ width: 16px;
78
+ }
79
+
64
80
  </style>
65
81
  <title>Simple Key/Value Store (SKVS)</title>
66
82
  </head>
67
83
  <body>
84
+ <div>
68
85
  <h1>Simple Key/Value Store (SKVS)</h1>
69
86
 
70
87
  <form id="search" method="get" action="<%= url("/") %>">
@@ -72,10 +89,13 @@
72
89
  </form>
73
90
 
74
91
  <form id="main" method="post" action="<%= url("/_set") %>">
92
+ </form>
75
93
 
76
94
  <table id="data">
77
95
  <thead>
78
96
  <tr>
97
+ <th class="buttons">
98
+ </th>
79
99
  <th>
80
100
  <input form="main" name="key" placeholder="key" required />
81
101
  </th>
@@ -87,7 +107,7 @@
87
107
  </thead>
88
108
  <tfoot>
89
109
  <tr>
90
- <td colspan="2">
110
+ <td colspan="3">
91
111
  <% if @count > load_count %>
92
112
  Showing <strong><%= load_count %></strong> of <strong><%= @count %></strong>,
93
113
  <a href="<%= url("/?load_count=#{load_count*2}&q=#{URI.encode(params[:q].to_s)}") %>">
@@ -102,6 +122,11 @@
102
122
  <tbody>
103
123
  <% @data.each do |k,v| %>
104
124
  <tr>
125
+ <th class="buttons">
126
+ <button class="delete" data-url="<%= url("/#{k}") %>">
127
+ delete
128
+ </button>
129
+ </th>
105
130
  <th><a href="<%= url("/#{k}") %>"><%=h k %></a></th>
106
131
  <% if v.length < 100 %>
107
132
  <td><%=hbr v %></td>
@@ -112,8 +137,7 @@
112
137
  <% end %>
113
138
  </tbody>
114
139
  </table>
115
-
116
- </form>
140
+ </div>
117
141
 
118
142
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
119
143
 
@@ -161,6 +185,16 @@
161
185
  update(document.location);
162
186
  })
163
187
 
188
+ $("body").on("click", ".delete", function(){
189
+ var el = this;
190
+ $(el).parents("tr").hide();
191
+ $.ajax($(this).attr("data-url"), {type: "put", data: {}, complete: function(){
192
+ $(el).parents("tr").remove();
193
+ }});
194
+
195
+ return false;
196
+ });
197
+
164
198
  $("#search input")
165
199
  .on("keyup", seachCallback)
166
200
  .on("change", seachCallback)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skvs
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Lea
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-09 00:00:00 Z
18
+ date: 2012-02-12 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: redis