From 7b9b226e591c92c6cd97031eb31cdcbb50115df1 Mon Sep 17 00:00:00 2001 From: Andreas Stephanides Date: Wed, 2 Sep 2015 21:03:01 +0200 Subject: [PATCH] AutoCommit Mit Sep 2 21:03:01 CEST 2015 --- .../themes/blue2/fetprofiles/show.html.erb | 78 ++++++++++++++++++- spec/factories/fetprofiles.rb | 7 ++ spec/views/fetprofiles/show.html.erb_spec.rb | 24 ++++-- 3 files changed, 100 insertions(+), 9 deletions(-) diff --git a/app/views/themes/blue2/fetprofiles/show.html.erb b/app/views/themes/blue2/fetprofiles/show.html.erb index e600449..4036269 100644 --- a/app/views/themes/blue2/fetprofiles/show.html.erb +++ b/app/views/themes/blue2/fetprofiles/show.html.erb @@ -1,3 +1,77 @@ -
please remove this from blue2 theme
- <%= render partial: "interninfo", object: @fetprofile if can?(:seeintern, @fetprofile) %> +<%= content_for :header do %> +FET - <%= @fetprofile.name %> +<% unless @fetprofile.picture.url.nil? + picture_url=URI(root_url) + picture_url.path=@fetprofile.picture.portrait.url +end +%> +<% set_meta_tags :og => { + :image => picture_url.to_s, + :title => @fetprofile.name.to_s , + :type => "profile", + :url=>fetprofile_url(@fetprofile,:theme=>nil), +:profile=> { + :first_name=>@fetprofile.vorname, + :last_name=>@fetprofile.nachname + } +} +%> +<% set_meta_tags :og=>{:article=> {:published_time=>I18n.l(@neuigkeit.try(:datum).try(:to_date)) }} unless @neuigkeit.try(:datum).try(:to_date).nil? %> + +<%= display_meta_tags %> +<% end %> + + +<%= render 'fetprofiles/tabs' %> + +
+ +

<%= notice %>

+
+ + +
+ + + <%= image_tag @fetprofile.picture.portrait.url %> + + + + + +
+

<%= @fetprofile.vorname %> <%= @fetprofile.nachname %><% unless @fetprofile.short.empty? %> <%= @fetprofile.short %> <% end %>

+ + +

+ <%= @fetprofile.fetmail %> +

+

+ <%= @fetprofile.desc %> +

+ <%= render partial: "interninfo", object: @fetprofile if can?(:seeintern, @fetprofile) %> + +
    + <% @memberships.each do |m| %> +
  • + <%= link_to m.gremium do %> <%= render m %><% end %> + <%= link_to I18n.t('common.edit'), edit_fetprofile_membership_path(@fetprofile,m) if params["verwalten"] && can?(:edit, m)%> + <%= link_to I18n.t('common.delete'), [@fetprofile, m], method: :delete, data: {confirm: I18n.t('common.sure_del')} if params["verwalten"] && can?(:delete, m ) %> +
  • + <% end %> +
+ +
+
+
+<% if can?(:edit, @fetprofile) %> +
+ + <%= link_to ff_icon("icon-pencil")+I18n.t('common.edit'), edit_fetprofile_path(@fetprofile) if can?(:edit, @fetprofile) %> + <%= link_to fa_icon("trash")+I18n.t('common.delete'), fetprofile_path(@fetprofile),method: :delete, data: { confirm: "Are you sure?" } if can?(:delete, @fetprofile) %> + +
+<% end %> + <%#= render 'layouts/pretty_toolbar' %> +
diff --git a/spec/factories/fetprofiles.rb b/spec/factories/fetprofiles.rb index c9c56a3..07decc8 100644 --- a/spec/factories/fetprofiles.rb +++ b/spec/factories/fetprofiles.rb @@ -11,5 +11,12 @@ FactoryGirl.define do active false birth_month 4 birth_day 2 + factory :fetprofile_withadress do + street "some street" + plz "1231" + city "vienna" + telnr "sdf tel nummer" + hdynr "sdf hdy nummer" + end end end diff --git a/spec/views/fetprofiles/show.html.erb_spec.rb b/spec/views/fetprofiles/show.html.erb_spec.rb index 22a6e65..fac5430 100644 --- a/spec/views/fetprofiles/show.html.erb_spec.rb +++ b/spec/views/fetprofiles/show.html.erb_spec.rb @@ -3,13 +3,15 @@ require 'spec_helper' # ActionView.any_instance.stub!(:view_paths).and_return([ 'app/views/themes/blue2']) describe "fetprofiles/show", :type => :view do -["blue1", "blue2","2003"].each do |theme| -describe "theme #{theme}" do + ["blue2"].each do |theme| + describe "theme #{theme}" do + before(:each) do + view.view_paths=[ "app/views/themes/#{theme}", "app/views"] + end before(:each) do - view.view_paths=[ "app/views/themes/#{theme}", "app/views"] default_url_options[:locale] = :de - @fetprofile = FactoryGirl.create(:fetprofile,:street => "secret adress") + @fetprofile = FactoryGirl.create(:fetprofile_withadress) assign(:fetprofile,@fetprofile) assign(:memberships, []) assign(:gremientabs, []) @@ -71,21 +73,29 @@ end # rendered.should match(/false/) end - it "doesn't render secrets" do + it "doesn't render address" do render expect(rendered).not_to match(/#{@fetprofile.street}/) + expect(rendered).not_to match(/#{@fetprofile.city}/) + expect(rendered).not_to match(/#{@fetprofile.hdynr}/) + expect(rendered).not_to match(/#{@fetprofile.telnr}/) + expect(rendered).not_to match(/#{@fetprofile.plz}/) + end describe "with fet user" do login_fet_user -let(:current_ability) {@ability} +# let(:current_ability) {@ability} it "renders address" do render expect(rendered).to match(/#{@fetprofile.street}/) expect(rendered).to match(/#{@fetprofile.plz}/) + expect(rendered).to match(/#{@fetprofile.city}/) + expect(rendered).to match(/#{@fetprofile.hdynr}/) + expect(rendered).to match(/#{@fetprofile.telnr}/) end - pending "renders edit path" do + it "renders edit path" do render expect(rendered).to match(/#{edit_fetprofile_path(@fetprofile)}/) end