Browse files

Search v 0.1

  • Loading branch information...
1 parent fb4a4ae commit 8293397421a42ff12b29d4a5f2dbb7394b7221d4 @ionmx ionmx committed Apr 16, 2012
View
BIN app/assets/images/icons/group.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN app/assets/images/icons/page.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1 app/assets/stylesheets/application.css.scss
@@ -11,6 +11,7 @@
@import "users";
@import "groups";
@import "pages";
+@import "search";
@import "lightbox";
@import "ui";
@import "dialogs";
View
9 app/assets/stylesheets/layout.css.scss
@@ -35,15 +35,6 @@
height: 18px;
width: $search-box-width - 10;
}
- #search-results {
- display: none;
- background-color: $bg-color;
- border: 1px solid $line-color;
- position: absolute;
- width: $user-area-width + $search-box-width;
- top: 46px;
- padding: 10px;
- }
}
#user-area {
View
56 app/assets/stylesheets/search.css.scss
@@ -1,3 +1,59 @@
// Place all the styles related to the Search controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
+
+#search-results {
+ display: none;
+ background-color: $bg-color;
+ border: 1px solid $line-color;
+ position: absolute;
+ width: $user-area-width + $search-box-width;
+ top: 46px;
+ .search-section {
+ background: $light-grey;
+ font-size: 90%;
+ padding: 3px 10px;
+ }
+ ul {
+ li {
+ padding: 5px 10px;
+ border-top: 1px solid $white;
+ border-bottom: 1px solid $line-color;
+ a {
+ text-decoration: none;
+ color: $black;
+ }
+ &:hover {
+ background-color: $nav-hover-color;
+ }
+ }
+ }
+ .search-item-display {
+ float: left;
+ }
+ .search-item-title {
+ width: $user-area-width + $search-box-width - 70;
+ float: left;
+ margin-left: 10px;
+ font-weight: bold;
+ &:hover { cursor: pointer; }
+ }
+ .search-item-desc {
+ margin: 4px 0;
+ width: $user-area-width + $search-box-width - 70;
+ float: left;
+ margin-left: 10px;
+ font-size: 90%;
+ margin-bottom: 10px;
+ .search-item-phone,
+ .search-item-email,
+ .search-item-department {
+ margin: 4px 0;
+ &:hover { cursor: pointer; }
+ }
+ .search-item-email { margin: 0; }
+ }
+}
+
+
+
View
55 app/views/search/search.html.haml
@@ -1,12 +1,43 @@
-.search-section= t :persons
-%ul
- - @users.each do |u|
- %li= u.full_name
-.search-section= t :groups
-%ul
- - @groups.each do |g|
- %li= g.name
-.search-section= t :pages
-%ul
- - @pages.each do |p|
- %li= p.title
+- if @users.count > 0
+ .search-section= t :persons
+ %ul
+ - @users.each do |u|
+ %li
+ = link_to url_for(:controller => "users", :action => "profile", :username => "#{u.username}"), :method => :get, :remote => true, :class => 'get-user', :'data-type' => 'html', :id => "search_user_#{u.id}", :username => "#{u.username}" do
+ .search-item-display= image_tag u.image_url(:small).to_s, :width => 32, :height => 32, :class => "profile-picture-small", :title => "#{u.display_name}"
+ .search-item-title= u.display_name
+ .search-item-desc
+ .search-item-email= u.email
+ .search-item-phone= u.work_phone
+ .search-item-groups
+ - user_groups = Array.new
+ - u.groups.each do |g|
+ - if g.group_type.display_in > 0
+ - user_groups << g.name
+ = user_groups.join(',')
+ .clearfix
+- if @groups.count > 0
+ .search-section= t :groups
+ %ul
+ - @groups.each do |g|
+ %li
+ = link_to url_for(:controller => "groups", :action => "show", :short_name => "#{g.short_name}"), :method => :get, :remote => true, :class => 'get-group', :'data-type' => 'html', :id => "search_group_#{g.id}", :short_name => "#{g.short_name}", :group_id => g.id do
+ .search-item-display
+ = image_tag '/assets/icons/group.png', :width => 32, :height => 32, :class => "profile-picture-small"
+ .search-item-title= g.name
+ .search-item-desc= g.description
+ .clearfix
+- if @pages.count > 0
+ .search-section= t :pages
+ %ul
+ - @pages.each do |p|
+ %li
+ = link_to url_for(:controller => "pages", :action => "show_group_page", :group_short_name => p.group.short_name, :page_short_name => p.short_name), :method => :get, :remote => true, :class => 'get-page', :'data-type' => 'html', :id => "page_link_#{p.id}", :group_name => "#{p.group.short_name}", :short_name => "#{p.short_name}", :page_id => "#{p.id}" do
+ .search-item-display
+ = image_tag '/assets/icons/page.png', :width => 32, :height => 32, :class => "profile-picture-small"
+ .search-item-title= p.title
+ .search-item-desc= p.group.name
+ .clearfix
+
+
+

0 comments on commit 8293397

Please sign in to comment.