Adding initial contrib modules system

stable
Jesús Espino 2015-01-19 16:34:56 +01:00
parent 48b68e42af
commit 116a6c335b
9 changed files with 181 additions and 5 deletions

View File

@ -20,6 +20,7 @@
###
@taiga = taiga = {}
@.taigaContribPlugins = @.taigaContribPlugins or []
# Generic function for generate hash from a arbitrary length
# collection of parameters.
@ -104,6 +105,8 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
{templateUrl: "/partials/admin-third-parties-gitlab.html"})
$routeProvider.when("/project/:pslug/admin/third-parties/bitbucket",
{templateUrl: "/partials/admin-third-parties-bitbucket.html"})
$routeProvider.when("/project/:pslug/admin/contrib/:plugin",
{templateUrl: "/partials/contrib/main.html"})
# User settings
$routeProvider.when("/project/:pslug/user-settings/user-profile",
@ -218,6 +221,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven
init = ($log, $i18n, $config, $rootscope, $auth, $events, $analytics) ->
$i18n.initialize($config.get("defaultLanguage"))
$log.debug("Initialize application")
$rootscope.contribPlugins = @.taigaContribPlugins
if $auth.isAuthenticated()
$events.setupConnection()
@ -256,7 +260,7 @@ modules = [
# Vendor modules
"ngRoute",
"ngAnimate",
]
].concat(_.map(@.taigaContribPlugins, (plugin) -> plugin.module))
# Main module definition
module = angular.module("taiga", modules)

View File

@ -95,6 +95,7 @@ urls = {
"project-admin-third-parties-github": "/project/:project/admin/third-parties/github"
"project-admin-third-parties-gitlab": "/project/:project/admin/third-parties/gitlab"
"project-admin-third-parties-bitbucket": "/project/:project/admin/third-parties/bitbucket"
"project-admin-contrib": "/project/:project/admin/contrib/:plugin"
# User settings
"user-settings-user-profile": "/project/:project/user-settings/user-profile"

View File

@ -0,0 +1,56 @@
###
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# File: modules/base/contrib.coffee
###
taigaContribPlugins = @.taigaContribPlugins = @.taigaContribPlugins or []
class ContribController extends taiga.Controller
@.$inject = ["$rootScope", "$scope", "$routeParams", "$tgRepo", "$tgResources", "$tgConfirm", "$appTitle"]
constructor: (@rootScope, @scope, @params, @repo, @rs, @confirm, @appTitle) ->
@scope.currentPlugin = _.first(_.where(taigaContribPlugins, {"slug": @params.plugin}))
@scope.pluginTemplate = "contrib/#{@scope.currentPlugin.slug}"
@scope.projectSlug = @params.pslug
@scope.adminPlugins = _.where(@rootScope.contribPlugins, {"type": "admin"})
promise = @.loadInitialData()
promise.then () =>
@appTitle.set(@scope.project.name)
promise.then null, =>
@confirm.notify("error")
loadProject: ->
return @rs.projects.get(@scope.projectId).then (project) =>
@scope.project = project
@scope.$emit('project:loaded', project)
@scope.$broadcast('project:loaded', project)
return project
loadInitialData: ->
promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
@scope.projectId = data.project
return data
return promise.then(=> @.loadProject())
module = angular.module("taigaBase")
module.controller("ContribController", ContribController)

View File

@ -0,0 +1,12 @@
block head
title Taiga Your agile, free, and open source project management tool
block content
div.wrapper.roles(ng-init="section='admin'", ng-controller="ContribController as ctrl")
sidebar.menu-secondary.sidebar(tg-admin-navigation="contrib")
include ../views/modules/admin-menu
sidebar.menu-tertiary.sidebar
include ../views/modules/admin-submenu-contrib
section.main.admin-common.admin-contrib(ng-include="pluginTemplate")

View File

@ -24,3 +24,7 @@ section.admin-menu
a(href="" tg-nav="project-admin-third-parties-github:project=project.slug")
span.title Third parties
span.icon.icon-arrow-right
li#adminmenu-contrib(ng-show="contribPlugins")
a(href="" tg-nav="project-admin-contrib:project=project.slug,plugin=contribPlugins[0].slug")
span.title Contrib plugins
span.icon.icon-arrow-right

View File

@ -0,0 +1,10 @@
section.admin-submenu
header
h1 Contrib plugins
nav
ul
li#adminmenu-contrib(ng-repeat="plugin in adminPlugins")
a(href="", tg-nav="project-admin-contrib:project=projectSlug,plugin=plugin.slug" ng-class="{active: plugin.slug == currentPlugin.slug}")
span.title {{ plugin.name }}
span.icon.icon-arrow-right

View File

@ -11,6 +11,7 @@
a {
display: block;
padding: 1rem 0 1rem 1rem;
&.active,
&:hover {
.icon {
opacity: 1;
@ -18,10 +19,6 @@
}
}
}
.active {
opacity: 1;
transition: opacity .3s linear;
}
.icon {
color: $blackish;
float: right;

View File

@ -0,0 +1,91 @@
.admin-contrib {
form {
margin: 1rem 0;
max-width: 700px;
width: 100%;
}
input[type="text"],
textarea {
@extend %title;
}
fieldset {
margin-bottom: 1rem;
}
label {
@extend %title;
display: block;
margin-bottom: .2rem;
}
textarea {
height: 10rem;
}
.button-green {
color: $white;
display: block;
text-align: center;
}
.select-input-text {
.field-with-option {
display: flex;
}
.option-wrapper {
align-items: center;
border: 1px solid $gray-light;
border-left: 0;
border-radius: 0 5px 5px 0;
cursor: pointer;
display: flex;
padding: 0 1rem;
}
.help-copy {
@extend %small;
opacity: 0;
&.visible {
opacity: 1;
transition: opacity .2s linear;
}
}
}
.help {
margin-top: 2rem;
h3 {
font-family: opensans-semibold;
margin-bottom: 1rem;
}
ol {
padding: 0 0 0 2rem;
span {
font-family: opensans-semibold;
}
}
.img {
margin-bottom: 1rem;
}
.alt-image {
@extend %small;
font-style: italic;
}
code {
@extend %small;
background: $whitish;
direction: ltr;
display: block;
font-family: 'courier new', 'monospace';
line-height: 1.4rem;
margin-bottom: 1rem;
padding: .5rem;
unicode-bidi: embed;
white-space: pre;
width: 100%;
}
.code-info {
padding-left: 1rem;
li {
margin-bottom: .5rem;
}
span {
font-family: opensans-semibold;
}
}
}
}

View File

@ -124,6 +124,7 @@ exports.files = function () {
'modules/admin/default-values',
'modules/admin/project-values',
'modules/admin/third-parties',
'modules/admin/contrib',
//Modules user Settings
'modules/user-settings/user-profile',