Commit 52bcd04df83a895b4ad2da3c31b30aaa55559518
1 parent
439fe345
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
fix gitlab integration
Showing
9 changed files
with
53 additions
and
6 deletions
Show diff stats
plugins/serpro_integration/lib/ext/community.rb
| ... | ... | @@ -12,7 +12,7 @@ class Community |
| 12 | 12 | |
| 13 | 13 | attr_accessible :allow_unauthenticated_comments, :allow_gitlab_integration, :allow_sonar_integration, :allow_jenkins_integration, :serpro_integration_plugin_gitlab, :serpro_integration_plugin_jenkins, :serpro_integration_plugin_sonar |
| 14 | 14 | |
| 15 | - after_update :create_integration_projects | |
| 15 | + before_update :create_integration_projects | |
| 16 | 16 | |
| 17 | 17 | def create_integration_projects |
| 18 | 18 | return unless setting_changed?(:serpro_integration_plugin_gitlab) |
| ... | ... | @@ -20,6 +20,7 @@ class Community |
| 20 | 20 | if allow_gitlab_integration |
| 21 | 21 | gitlab_integration = SerproIntegrationPlugin::GitlabIntegration.new(gitlab_host, gitlab_private_token) |
| 22 | 22 | gitlab_project = gitlab_integration.create_gitlab_project(self) |
| 23 | + serpro_integration_plugin_gitlab[:project_id] = gitlab_project.id | |
| 23 | 24 | |
| 24 | 25 | if allow_jenkins_integration |
| 25 | 26 | jenkins_integration = SerproIntegrationPlugin::JenkinsIntegration.new(jenkins_host, jenkins_private_token, jenkins_user) | ... | ... |
plugins/serpro_integration/lib/serpro_integration_plugin.rb
| ... | ... | @@ -11,8 +11,8 @@ class SerproIntegrationPlugin < Noosfero::Plugin |
| 11 | 11 | #FIXME make this test |
| 12 | 12 | # User could not have this block |
| 13 | 13 | def self.extra_blocks |
| 14 | - { SonarPlugin::SonarWidgetBlock => {:type => [Community] }, | |
| 15 | - SonarPlugin::SmileBlock => {:type => [Community] } | |
| 14 | + { SerproIntegrationPlugin::SonarWidgetBlock => {:type => [Community] }, | |
| 15 | + SerproIntegrationPlugin::SmileBlock => {:type => [Community] }, | |
| 16 | 16 | } |
| 17 | 17 | end |
| 18 | 18 | ... | ... |
plugins/serpro_integration/lib/serpro_integration_plugin/gitlab_integration.rb
| ... | ... | @@ -15,7 +15,7 @@ class SerproIntegrationPlugin::GitlabIntegration |
| 15 | 15 | def create_project(project_name, group) |
| 16 | 16 | path_with_namespace = "#{group.name}/#{project_name}" |
| 17 | 17 | #FIXME find project by namespace |
| 18 | - project = @client.projects(:scope => :all).select do |project| | |
| 18 | + project = @client.get("/projects/search/#{project_name}").select do |project| | |
| 19 | 19 | project.path_with_namespace == path_with_namespace |
| 20 | 20 | end.first |
| 21 | 21 | ... | ... |
plugins/serpro_integration/lib/serpro_integration_plugin/gitlab_issues_block.rb
0 → 100644
| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | +require 'open-uri' | |
| 2 | +require 'json' | |
| 3 | + | |
| 4 | +class SerproIntegrationPlugin::GitlabIssuesBlock < Block | |
| 5 | + | |
| 6 | + def self.description | |
| 7 | + _('Gitlab Issues') | |
| 8 | + end | |
| 9 | + | |
| 10 | + def help | |
| 11 | + _('This block list gitlab issues') | |
| 12 | + end | |
| 13 | + | |
| 14 | + #FIXME make this test | |
| 15 | + def content(args={}) | |
| 16 | + gitlab_integration = SerproIntegrationPlugin::GitlabIntegration.new(owner.gitlab_host, owner.gitlab_private_token) | |
| 17 | + issues = gitlab_integration.issues(owner) | |
| 18 | + block = self | |
| 19 | + proc do | |
| 20 | + render :file => 'blocks/gitlab_issues', :locals => {:issues => issues, :block => block} | |
| 21 | + end | |
| 22 | + #content_tag(:div, | |
| 23 | + # content_tag(:canvas, '', :id => smile_face_id, :width => '95%', :height => '95%' ) + | |
| 24 | + # "<script type='text/javascript'>drawFace('#{smile_face_id}', '#{self.smile_factor}')</script>", | |
| 25 | + # :class => 'smile' | |
| 26 | + #) | |
| 27 | + end | |
| 28 | + | |
| 29 | + def cacheable? | |
| 30 | + false | |
| 31 | + end | |
| 32 | + | |
| 33 | +end | ... | ... |
plugins/serpro_integration/lib/serpro_integration_plugin/smile_block.rb
plugins/serpro_integration/lib/serpro_integration_plugin/sonar_widget_block.rb
plugins/serpro_integration/views/blocks/_gitlab_issue.html.erb
0 → 100644
plugins/serpro_integration/views/blocks/gitlab_issues.html.erb
0 → 100644