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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4615d1bb2bee67a6f0a7457288fc2df6796045b
4
- data.tar.gz: 4d1f46f67c613b239f3a940d062f494c954ec969
3
+ metadata.gz: c78bf06c4f79cbc1f456eb2bd5750fe0ab93986e
4
+ data.tar.gz: de11ce169119121f0ab95dc2eabbc69707b67937
5
5
  SHA512:
6
- metadata.gz: abc4d90dfbd41be28d68801f5d7cbcd446ac7380e70960bbb3696b0c9a381a794d0c55ed23c1a7ffd1232bdda40f070315deb83fb1ed172ff73ce77c67bdd5d4
7
- data.tar.gz: 259e675f5fdbddb58a1ba88d4c474c0d4b00e0a98ef7e2f53f466df82248843af985c0b643a882c334afe4613f64237c11ad620b024567c430ef6da5d2efad21
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
- # For security reasons, this should only be available to employees.
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(20)
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 = permitted_people.where(affiliations: 'faculty').custom_search(params[:q]).asc(:first_name, :last_name)
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'}
@@ -1,3 +1,10 @@
1
+ / Example
2
+ / = wcms_component 'forms/yaml_editor',
3
+ / form: f,
4
+ / attribute: :presentation_yaml,
5
+ / value: @custom_profile.presentation_yaml
6
+ /
7
+
1
8
  ruby:
2
9
  form ||= nil
3
10
  attribute ||= nil
@@ -15,10 +15,16 @@
15
15
 
16
16
  ruby:
17
17
  menu ||= []
18
- crumbs ||= [{
19
- body: controller_name.titleize,
20
- url: {controller: controller_name, action: :index}
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
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module BiolaWcmsComponents
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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-02-28 00:00:00.000000000 Z
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