biola_wcms_components 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/components/forms/person_lookup.js.coffee +0 -2
- data/app/controllers/wcms_components/people_controller.rb +8 -4
- data/app/controllers/wcms_components/tags_controller.rb +11 -0
- data/app/views/wcms_components/forms/_related_object_tags.html.slim +3 -1
- data/app/views/wcms_components/forms/_yaml_editor.html.slim +7 -0
- data/app/views/wcms_components/navigation/_site_nav.html.slim +9 -3
- data/config/routes.rb +1 -2
- data/lib/biola_wcms_components/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c78bf06c4f79cbc1f456eb2bd5750fe0ab93986e
|
4
|
+
data.tar.gz: de11ce169119121f0ab95dc2eabbc69707b67937
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dce136a7e660e3aeac8051dcc3a0f78f848417d0928469bca3de6798eb3a7630cd22fbd900e0a7a895c9fd410f42ce9e6df957093320dfe1916380486c9881ae
|
7
|
+
data.tar.gz: a2c5af24de383959e0ab09725b2abb5e60035060db170ef960acd5130df3e66298285b67bcfbc1d05f86a811aa3acab532a1f7de3ea01eda8556d3a296473897
|
@@ -5,8 +5,6 @@ $(document).ready ->
|
|
5
5
|
peopleSearch = new Bloodhound(
|
6
6
|
datumTokenizer: Bloodhound.tokenizers.obj.whitespace('id')
|
7
7
|
queryTokenizer: Bloodhound.tokenizers.whitespace
|
8
|
-
# The prefetch url returns a list of all the faculty
|
9
|
-
prefetch: people_search_url
|
10
8
|
remote: people_search_url + '?q=%QUERY'
|
11
9
|
)
|
12
10
|
|
@@ -4,13 +4,12 @@ class WcmsComponents::PeopleController < ApplicationController
|
|
4
4
|
skip_after_action :verify_policy_scoped
|
5
5
|
|
6
6
|
def index
|
7
|
-
|
8
|
-
if current_user.admin? || current_user.has_role?(:employee)
|
7
|
+
if can_search_people?
|
9
8
|
if params[:q].present?
|
10
|
-
@people = permitted_people.custom_search(params[:q]).asc(:first_name, :last_name).limit(
|
9
|
+
@people = permitted_people.custom_search(params[:q]).asc(:first_name, :last_name).limit(10)
|
11
10
|
else
|
12
11
|
# If no query string is present, return all faculty for pre-cached data.
|
13
|
-
@people =
|
12
|
+
@people = []
|
14
13
|
end
|
15
14
|
|
16
15
|
render json: @people.map{|p| {id: p.id.to_s, name: p.name, email: p.biola_email, affiliations: p.affiliations.to_a.join(', '), image: p.profile_photo_url} }.to_json
|
@@ -27,4 +26,9 @@ class WcmsComponents::PeopleController < ApplicationController
|
|
27
26
|
Person.where({'$or' => [{affiliations: ['employee'] }, {privacy: { '$ne' => true }}] })
|
28
27
|
end
|
29
28
|
|
29
|
+
def can_search_people?
|
30
|
+
# For security reasons, this should only be available to employees and student workers
|
31
|
+
current_user.admin? || current_user.has_role?(:employee) || current_user.has_role?(:student_worker)
|
32
|
+
end
|
33
|
+
|
30
34
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class WcmsComponents::TagsController < ApplicationController
|
2
|
+
|
3
|
+
skip_after_action :verify_authorized
|
4
|
+
skip_after_action :verify_policy_scoped
|
5
|
+
|
6
|
+
def index
|
7
|
+
@tags = Tag.by_type('object').custom_search(params[:q]).limit(10)
|
8
|
+
render json: @tags.to_json(only: [:tag])
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -3,10 +3,12 @@ ruby:
|
|
3
3
|
attribute ||= nil
|
4
4
|
value ||= value
|
5
5
|
html_class ||= 'form-control'
|
6
|
+
lookup_url ||= wcms_components_tags_url
|
6
7
|
|
7
8
|
|
8
9
|
= wcms_component "forms/tag_input",
|
9
10
|
form: form,
|
10
11
|
attribute: :related_object_tags_string,
|
11
12
|
value: value,
|
12
|
-
html_class: html_class
|
13
|
+
html_class: html_class,
|
14
|
+
typeahead: { url: wcms_components_tags_url(format: :json), key: 'tag'}
|
@@ -15,10 +15,16 @@
|
|
15
15
|
|
16
16
|
ruby:
|
17
17
|
menu ||= []
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
default_crumbs = []
|
19
|
+
|
20
|
+
# Set @parent if you have nested routes.
|
21
|
+
_root_controller = @parent ? @parent.class.to_s.tableize : controller_name
|
22
|
+
default_crumbs = [{
|
23
|
+
body: _root_controller.titleize,
|
24
|
+
url: {controller: _root_controller, action: :index}
|
21
25
|
}]
|
26
|
+
|
27
|
+
crumbs ||= default_crumbs
|
22
28
|
crumbs += Array(add_crumbs) if defined?(add_crumbs)
|
23
29
|
|
24
30
|
|
data/config/routes.rb
CHANGED
@@ -2,9 +2,8 @@ Rails.application.routes.draw do
|
|
2
2
|
|
3
3
|
namespace :wcms_components do
|
4
4
|
resources :embedded_images, only: [:create], defaults: { format: 'json' }
|
5
|
-
|
6
|
-
# "people#index" is used for search purposes
|
7
5
|
resources :people, only: [:index], defaults: { format: 'json' }
|
6
|
+
resources :tags, only: [:index], defaults: { format: 'json' }
|
8
7
|
end
|
9
8
|
|
10
9
|
# this is just a convenience to create a named route to rack-cas' logout
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: biola_wcms_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Hall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ace-rails-ap
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- app/controllers/wcms_application_controller.rb
|
156
156
|
- app/controllers/wcms_components/embedded_images_controller.rb
|
157
157
|
- app/controllers/wcms_components/people_controller.rb
|
158
|
+
- app/controllers/wcms_components/tags_controller.rb
|
158
159
|
- app/helpers/wcms_components/alerts_helper.rb
|
159
160
|
- app/helpers/wcms_components/component_helper.rb
|
160
161
|
- app/helpers/wcms_components/navigation_helper.rb
|