Ejemplo n.º 1
0
 /**
  * Updates the order of project teams.
  *
  * @return array
  */
 public function postUpdateProjectTeamOrder()
 {
     $teamData = Binput::get('ids');
     foreach ($teamData as $order => $teamId) {
         ProjectTeam::find($teamId)->update(['order' => $order + 1]);
     }
     return $teamData;
 }
Ejemplo n.º 2
0
 /**
  * Seed the project teams table.
  *
  * @return void
  */
 protected function seedProjectTeams()
 {
     $defaultTeams = [['name' => 'Websites', 'order' => 1]];
     ProjectTeam::truncate();
     foreach ($defaultTeams as $team) {
         ProjectTeam::create($team);
     }
 }
Ejemplo n.º 3
0
 /**
  * Index page view composer.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     // Default data
     $withData = ['systemStatus' => 'info', 'systemMessage' => trans('gitamin.service.bad'), 'favicon' => 'favicon-high-alert'];
     if (Project::enabled()->notStatus(1)->count() === 0) {
         // If all our projects are ok, do we have any non-fixed issues?
         $issues = Issue::orderBy('created_at', 'desc')->get();
         $issueCount = $issues->count();
         if ($issueCount === 0 || $issueCount >= 1 && (int) $issues->first()->status === 4) {
             $withData = ['systemStatus' => 'success', 'systemMessage' => trans('gitamin.service.good'), 'favicon' => 'favicon'];
         }
     } else {
         if (Project::enabled()->whereIn('status', [2, 3])->count() > 0) {
             $withData['favicon'] = 'favicon-medium-alert';
         }
     }
     // Project & Project Team lists.
     $usedProjectTeams = Project::enabled()->where('team_id', '>', 0)->groupBy('team_id')->lists('team_id');
     $projectTeams = ProjectTeam::whereIn('id', $usedProjectTeams)->orderBy('order')->get();
     $unteamedProjects = Project::enabled()->where('team_id', 0)->orderBy('order')->orderBy('created_at')->get();
     $view->with($withData)->withProjectTeams($projectTeams)->withUnteamedProjects($unteamedProjects);
 }
Ejemplo n.º 4
0
 /**
  * Bind data to the view.
  *
  * @param \Illuminate\Contracts\View\View $view
  *
  * @return void
  */
 public function compose(View $view)
 {
     $view->withIssueCount(Issue::all()->count());
     $view->withProjectCount(Project::all()->count());
     $view->withProjectTeamCount(ProjectTeam::all()->count());
 }
Ejemplo n.º 5
0
 /**
  * Shows the add project view.
  *
  * @return \Illuminate\View\View
  */
 public function showAddProject()
 {
     $teamId = (int) Binput::get('team_id');
     return View::make('dashboard.projects.add')->withPageTitle(trans('dashboard.projects.add.title') . ' - ' . trans('dashboard.dashboard'))->withTeamId($teamId)->withTeams(ProjectTeam::all());
 }
Ejemplo n.º 6
0
 /**
  * Get all teams.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getTeams(Request $request)
 {
     $teams = ProjectTeam::paginate(Binput::get('per_page', 20));
     return $this->paginator($teams, $request);
 }
Ejemplo n.º 7
0
 /**
  * Shows the edit issue view.
  *
  * @param \Gitamin\Models\Issue $issue
  *
  * @return \Illuminate\View\View
  */
 public function showEditIssueAction(Issue $issue)
 {
     return View::make('dashboard.issues.edit')->withPageTitle(trans('dashboard.issues.edit.title') . ' - ' . trans('dashboard.dashboard'))->withIssue($issue)->withProjectsInTeams(ProjectTeam::with('projects')->get())->withProjectsOutTeams(Project::where('team_id', 0)->get());
 }
 /**
  * Handle the add project team command.
  *
  * @param \Gitamin\Commands\ProjectTeam\AddProjectTeamCommand $command
  *
  * @return \Gitamin\Models\ProjectTeam
  */
 public function handle(AddProjectTeamCommand $command)
 {
     $team = ProjectTeam::create(['name' => $command->name, 'slug' => $command->slug, 'order' => $command->order]);
     event(new ProjectTeamWasAddedEvent($team));
     return $team;
 }