OSDN Git Service

Group and team rss is valid now
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Sun, 10 Mar 2013 10:16:57 +0000 (12:16 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Sun, 10 Mar 2013 10:16:57 +0000 (12:16 +0200)
app/assets/stylesheets/gitlab_bootstrap/mixins.scss
app/views/commits/_head.html.haml
app/views/dashboard/show.atom.builder
app/views/groups/show.atom.builder
app/views/groups/show.html.haml
app/views/issues/_head.html.haml
app/views/teams/show.atom.builder [new file with mode: 0644]
app/views/teams/show.html.haml
config/routes.rb
features/teams/team.feature

index 1e5fff6..2f83ca0 100644 (file)
@@ -71,7 +71,7 @@
   color: $style_color;
   text-shadow: 0 1px 1px #FFF;
   font-size: 18px;
-  line-height: 42px;
+  line-height: 40px;
   font-weight: normal;
   letter-spacing: -1px;
 }
index 02debe4..20b9195 100644 (file)
@@ -23,6 +23,5 @@
 
   - if current_controller?(:commits) && current_user.private_token
     %li.pull-right
-      %span.rss-icon
-        = link_to project_commits_path(@project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Feed" do
-          = image_tag "rss_ui.png", title: "feed"
+      = link_to project_commits_path(@project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Feed" do
+        %i.icon-rss
index 2bb42a6..29b2e4a 100644 (file)
@@ -1,8 +1,8 @@
 xml.instruct!
 xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
   xml.title   "Dashboard feed#{" - #{current_user.name}" if current_user.name.present?}"
-  xml.link    :href => projects_url(:atom), :rel => "self", :type => "application/atom+xml"
-  xml.link    :href => projects_url, :rel => "alternate", :type => "text/html"
+  xml.link    :href => dashboard_url(:atom), :rel => "self", :type => "application/atom+xml"
+  xml.link    :href => dashboard_url, :rel => "alternate", :type => "text/html"
   xml.id      projects_url
   xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any?
 
index 9aa52ea..5f2999c 100644 (file)
@@ -1,8 +1,8 @@
 xml.instruct!
 xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
-  xml.title   "Dashboard feed#{" - #{current_user.name}" if current_user.name.present?}"
-  xml.link    :href => projects_url(:atom), :rel => "self", :type => "application/atom+xml"
-  xml.link    :href => projects_url, :rel => "alternate", :type => "text/html"
+  xml.title   "Group feed - #{@group.name}"
+  xml.link    :href => group_path(@group, :atom), :rel => "self", :type => "application/atom+xml"
+  xml.link    :href => group_path(@group), :rel => "alternate", :type => "text/html"
   xml.id      projects_url
   xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any?
 
index 81694b8..adf249f 100644 (file)
       .description.well.light
         = @group.description
     = render "projects", projects: @projects
-    %div
-      %span.rss-icon
-        = link_to dashboard_path(:atom, { private_token: current_user.private_token }) do
-          = image_tag "rss_ui.png", title: "feed"
-          %strong News Feed
+    .prepend-top-20
+      = link_to group_path(@group, { format: :atom, private_token: current_user.private_token }), title: "Feed" do
+        %strong
+          %i.icon-rss
+          News Feed
 
     %hr
     .gitlab-promo
index 7e0b2cd..44d14d5 100644 (file)
@@ -6,6 +6,5 @@
   = nav_link(controller: :labels) do
     = link_to 'Labels', project_labels_path(@project), class: "tab"
   %li.pull-right
-    %span.rss-icon
-      = link_to project_issues_path(@project, :atom, { private_token: current_user.private_token }) do
-        = image_tag "rss_ui.png", title: "feed"
+    = link_to project_issues_path(@project, :atom, { private_token: current_user.private_token }) do
+      %i.icon-rss
diff --git a/app/views/teams/show.atom.builder b/app/views/teams/show.atom.builder
new file mode 100644 (file)
index 0000000..bb0f666
--- /dev/null
@@ -0,0 +1,29 @@
+xml.instruct!
+xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://search.yahoo.com/mrss/" do
+  xml.title   "Team feed - #{@team.name}"
+  xml.link    :href => team_url(@team, :atom), :rel => "self", :type => "application/atom+xml"
+  xml.link    :href => team_url(@team), :rel => "alternate", :type => "text/html"
+  xml.id      projects_url
+  xml.updated @events.maximum(:updated_at).strftime("%Y-%m-%dT%H:%M:%SZ") if @events.any?
+
+  @events.each do |event|
+    if event.proper?
+      event = EventDecorator.decorate(event)
+      xml.entry do
+        event_link = event.feed_url
+        event_title = event.feed_title
+
+        xml.id      "tag:#{request.host},#{event.created_at.strftime("%Y-%m-%d")}:#{event.id}"
+        xml.link    :href => event_link
+        xml.title   truncate(event_title, :length => 80)
+        xml.updated event.created_at.strftime("%Y-%m-%dT%H:%M:%SZ")
+        xml.media   :thumbnail, :width => "40", :height => "40", :url => gravatar_icon(event.author_email)
+        xml.author do |author|
+          xml.name event.author_name
+          xml.email event.author_email
+        end
+        xml.summary event_title
+      end
+    end
+  end
+end
index 43cc026..2eb0283 100644 (file)
       .description.well.light
         = @team.description
     = render "projects", projects: @projects
-    %div
-      %span.rss-icon
-        = link_to dashboard_path(:atom, { private_token: current_user.private_token }) do
-          = image_tag "rss_ui.png", title: "feed"
-          %strong News Feed
+    .prepend-top-20
+      = link_to team_path(@team, { format: :atom, private_token: current_user.private_token }), title: "Feed" do
+        %strong
+          %i.icon-rss
+          News Feed
 
     %hr
     .gitlab-promo
index b06fda8..27977ae 100644 (file)
@@ -135,7 +135,7 @@ Gitlab::Application.routes.draw do
   #
   # Groups Area
   #
-  resources :groups, constraints: { id: /[^\/]+/ }  do
+  resources :groups, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/}  do
     member do
       get :issues
       get :merge_requests
@@ -148,7 +148,7 @@ Gitlab::Application.routes.draw do
   #
   # Teams Area
   #
-  resources :teams, constraints: { id: /[^\/]+/ } do
+  resources :teams, constraints: {id: /(?:[^.]|\.(?!atom$))+/, format: /atom/} do
     member do
       get :issues
       get :merge_requests
index f777459..e15e3f0 100644 (file)
@@ -4,11 +4,6 @@ Feature: UserTeams
     And I own project "Shop"
     And project "Shop" has push event
 
-  Scenario: No teams, no dashboard info block
-    When I do not have teams with me
-    And I visit dashboard page
-    Then I should see dashboard page without teams info block
-
   Scenario: I should see teams info block
     When I have teams with my membership
     And I visit dashboard page