notable_web 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +1 -1
- data/README.md +13 -1
- data/app/assets/javascripts/notable_web.js +2 -0
- data/app/controllers/notable_web/home_controller.rb +10 -3
- data/app/views/layouts/notable_web/application.html.erb +11 -8
- data/app/views/notable_web/home/index.html.erb +3 -3
- data/lib/notable_web/engine.rb +3 -0
- data/lib/notable_web/version.rb +1 -1
- metadata +32 -22
- data/.gitignore +0 -14
- data/Gemfile +0 -4
- data/Rakefile +0 -2
- data/notable_web.gemspec +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ad2f229ad7304302d16581c3173f8889b97d834d4c3d53ce097614acbc9c0979
|
4
|
+
data.tar.gz: fc90371c287986b808f5795efa88f504fd705a4871d34f4c3d89511d4025b771
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed8840e9a6594790892aacc0f52c727bae2012b8a888213cc6da85805edefcce5f43bec64d092d9f0011f8da90e01c229f3280676f350b368979c2aea1104248
|
7
|
+
data.tar.gz: 8383fc0ded9a02635378628f88c0b740cb8a8064081aa2c295b6cbad060f7d5b1d63595c6be75776c33a7d1be73325c3513d71d9be1e272ffc63eae495a68222
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -30,11 +30,23 @@ ENV["NOTABLE_PASSWORD"] = "secret"
|
|
30
30
|
#### Devise
|
31
31
|
|
32
32
|
```ruby
|
33
|
-
authenticate :user,
|
33
|
+
authenticate :user, ->(user) { user.admin? } do
|
34
34
|
mount NotableWeb::Engine, at: "notable"
|
35
35
|
end
|
36
36
|
```
|
37
37
|
|
38
|
+
#### will_paginate
|
39
|
+
|
40
|
+
If using will_paginate, create an initializer `config/initializers/kaminari.rb` with:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
Kaminari.configure do |config|
|
44
|
+
config.page_method_name = :per_page_kaminari
|
45
|
+
end
|
46
|
+
```
|
47
|
+
|
48
|
+
to avoid conflicts.
|
49
|
+
|
38
50
|
## Contributing
|
39
51
|
|
40
52
|
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
@@ -2,13 +2,20 @@ module NotableWeb
|
|
2
2
|
class HomeController < ActionController::Base
|
3
3
|
layout "notable_web/application"
|
4
4
|
|
5
|
+
protect_from_forgery with: :exception
|
6
|
+
|
5
7
|
http_basic_authenticate_with name: ENV["NOTABLE_USERNAME"], password: ENV["NOTABLE_PASSWORD"] if ENV["NOTABLE_PASSWORD"]
|
6
8
|
|
7
9
|
def index
|
8
|
-
|
10
|
+
@safe_params = params.slice(:status, :note_type, :note, :user_id, :user_type, :action_name, :status, :scope).permit!.to_h
|
11
|
+
|
12
|
+
where = @safe_params.slice(:status, :note_type, :note, :user_id, :user_type)
|
13
|
+
where = {notable_requests: where} if where.any?
|
14
|
+
|
15
|
+
page_method_name = Kaminari.config.page_method_name
|
9
16
|
|
10
17
|
# https://github.com/rails/rails/issues/9055
|
11
|
-
@requests = Notable::Request.order("notable_requests.id DESC").where(where).preload(:user).
|
18
|
+
@requests = Notable::Request.order("notable_requests.id DESC").where(where).preload(:user).public_send(page_method_name, params[:page]).per(100)
|
12
19
|
|
13
20
|
if params[:action_name]
|
14
21
|
@requests = @requests.where(action: params[:action_name])
|
@@ -44,7 +51,7 @@ module NotableWeb
|
|
44
51
|
break if user_ids.size >= 20
|
45
52
|
end
|
46
53
|
groups = user_ids.group_by{|v| v[1] }
|
47
|
-
where = [groups.map{|_,
|
54
|
+
where = [groups.map{|_, _v| "(user_type = ? AND user_id IN (?))" }.join(" OR ")] + groups.flat_map{|v| [v[0], v[1].map{|v1| v1[0] }] }
|
48
55
|
@users = requests.includes(:user).where(where).order("created_at DESC").group_by(&:user)
|
49
56
|
end
|
50
57
|
|
@@ -64,8 +64,7 @@
|
|
64
64
|
}
|
65
65
|
</style>
|
66
66
|
|
67
|
-
|
68
|
-
<%= javascript_include_tag "//www.google.com/jsapi", "chartkick" %>
|
67
|
+
<%= javascript_include_tag "notable_web" %>
|
69
68
|
</head>
|
70
69
|
<body>
|
71
70
|
<div class="container">
|
@@ -94,12 +93,16 @@
|
|
94
93
|
</div>
|
95
94
|
|
96
95
|
<script>
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
96
|
+
var nodes = document.querySelectorAll(".stream li")
|
97
|
+
for (var i = 0; i < nodes.length; i++) {
|
98
|
+
nodes[i].addEventListener("click", function(e) {
|
99
|
+
if (e.target.tagName != "A") {
|
100
|
+
var more = e.currentTarget.querySelector(".more")
|
101
|
+
var display = more.style.display == "block" ? "none" : "block"
|
102
|
+
more.style.display = display
|
103
|
+
}
|
104
|
+
})
|
105
|
+
}
|
103
106
|
</script>
|
104
107
|
</body>
|
105
108
|
</html>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<tr>
|
15
15
|
<td>
|
16
16
|
<%= agg.note %> <span style="color: #999;"><%= agg.action %></span>
|
17
|
-
<%= link_to "view",
|
17
|
+
<%= link_to "view", @safe_params.merge(note: agg.note, action_name: agg.action) %>
|
18
18
|
</td>
|
19
19
|
<td style="text-align: right;"><%= agg.count_user %></td>
|
20
20
|
<td style="text-align: right;"><%= agg.count_all %></td>
|
@@ -31,8 +31,8 @@
|
|
31
31
|
<%= render partial: "stream", locals: {requests: @requests, show_user: !(params[:user_id] && params[:user_type])} %>
|
32
32
|
|
33
33
|
<% if @requests.current_page != 1 %>
|
34
|
-
<%= link_to "Prev",
|
34
|
+
<%= link_to "Prev", @safe_params.merge(page: @requests.current_page - 1), style: "margin-right: 20px;" %>
|
35
35
|
<% end %>
|
36
36
|
<% if @requests.size == @requests.limit_value %>
|
37
|
-
<%= link_to "Next",
|
37
|
+
<%= link_to "Next", @safe_params.merge(page: @requests.current_page + 1) %>
|
38
38
|
<% end %>
|
data/lib/notable_web/engine.rb
CHANGED
data/lib/notable_web/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notable_web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: notable
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,14 +58,14 @@ dependencies:
|
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '2'
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '2'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: kaminari
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -84,42 +98,40 @@ dependencies:
|
|
84
98
|
name: bundler
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
|
-
- - "
|
101
|
+
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
103
|
+
version: '0'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
|
-
- - "
|
108
|
+
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
110
|
+
version: '0'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: rake
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
|
-
- - "
|
115
|
+
- - ">="
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
117
|
+
version: '0'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
|
-
- - "
|
122
|
+
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
description:
|
112
|
-
email:
|
113
|
-
- andrew@chartkick.com
|
124
|
+
version: '0'
|
125
|
+
description:
|
126
|
+
email: andrew@chartkick.com
|
114
127
|
executables: []
|
115
128
|
extensions: []
|
116
129
|
extra_rdoc_files: []
|
117
130
|
files:
|
118
|
-
-
|
119
|
-
- Gemfile
|
131
|
+
- CHANGELOG.md
|
120
132
|
- LICENSE.txt
|
121
133
|
- README.md
|
122
|
-
-
|
134
|
+
- app/assets/javascripts/notable_web.js
|
123
135
|
- app/controllers/notable_web/home_controller.rb
|
124
136
|
- app/views/layouts/notable_web/application.html.erb
|
125
137
|
- app/views/notable_web/home/_stream.html.erb
|
@@ -131,7 +143,6 @@ files:
|
|
131
143
|
- lib/notable_web.rb
|
132
144
|
- lib/notable_web/engine.rb
|
133
145
|
- lib/notable_web/version.rb
|
134
|
-
- notable_web.gemspec
|
135
146
|
homepage: https://github.com/ankane/notable_web
|
136
147
|
licenses:
|
137
148
|
- MIT
|
@@ -144,15 +155,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
155
|
requirements:
|
145
156
|
- - ">="
|
146
157
|
- !ruby/object:Gem::Version
|
147
|
-
version: '
|
158
|
+
version: '2.4'
|
148
159
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
160
|
requirements:
|
150
161
|
- - ">="
|
151
162
|
- !ruby/object:Gem::Version
|
152
163
|
version: '0'
|
153
164
|
requirements: []
|
154
|
-
|
155
|
-
rubygems_version: 2.2.2
|
165
|
+
rubygems_version: 3.0.3
|
156
166
|
signing_key:
|
157
167
|
specification_version: 4
|
158
168
|
summary: A web interface for Notable
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/notable_web.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'notable_web/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "notable_web"
|
8
|
-
spec.version = NotableWeb::VERSION
|
9
|
-
spec.authors = ["Andrew Kane"]
|
10
|
-
spec.email = ["andrew@chartkick.com"]
|
11
|
-
spec.summary = %q{A web interface for Notable}
|
12
|
-
spec.description = %q{A web interface for Notable}
|
13
|
-
spec.homepage = "https://github.com/ankane/notable_web"
|
14
|
-
spec.license = "MIT"
|
15
|
-
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_dependency "notable"
|
22
|
-
spec.add_dependency "groupdate"
|
23
|
-
spec.add_dependency "chartkick"
|
24
|
-
spec.add_dependency "kaminari"
|
25
|
-
spec.add_dependency "public_suffix"
|
26
|
-
|
27
|
-
spec.add_development_dependency "bundler", "~> 1.7"
|
28
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
29
|
-
end
|