Skip to content

Commit

Permalink
Nombre limité de tickets, pop-up descriptif et nombre affiché modifia…
Browse files Browse the repository at this point in the history
…ble.

Ceci est la version fonctionnelle et stable avant la fusion avec la branche Following qui introduira le glisser-déposer en javascript.
Les fonctions ajoutées ici: 

- limite au nombre d'items dans les colonnes du Todo (a)
- légende des priorités apparaissant lors du survol de souris au-dessus des pastilles colorées
- étiquette par défaut au moment de la création d'un billet
- le nombre d'items affichés (a) peut être changé par l'administrateur-système via la page Administration

This is the last version before drag-drop functions to be included in Todo list ( branch Following).
New features in this version:

- Limited number of items (issues) shown in ever Todo's columns (b)
- Description of every priority's color when mouse hovers the colored spot of an issue
- "Open" tag forced to be attached to a newly created issue
- Admin may change the number of items shown (b) in the Administration page
  • Loading branch information
Patriboom authored Oct 12, 2021
2 parents 174da4d + a1a3c0d commit 6c7b9a7
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 83 deletions.
4 changes: 2 additions & 2 deletions app/application/config/tinyissue.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
return array(
'release_date' => '11-10-2021',
'release_date' => '12-10-2021',
'version' => '1.8',
'release' => '6b'
'release' => '6c'
);
4 changes: 2 additions & 2 deletions app/application/controllers/ajax/ChgPrefGen.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
}
++$rendu;
}
fclose($RefFichier);

//Ajout des lignes nouvellement créées, pour ceux qui n'ont pas fait la mise à jour de leur fichier config.app.php
//12 octobre 2021
if (!isset($NumLigne['TodoNbItems'])) {
Expand All @@ -60,8 +62,6 @@
$MesLignes[($rendu++)] = $passe[2];
$MesLignes[($rendu++)] = $passe[1];
}
fclose($RefFichier);

//Enregistrement du nouveau fichier corrigé
$NeoFichier = fopen($NomFichier, "w");
foreach ($MesLignes as $ind => $val) {
Expand Down
97 changes: 32 additions & 65 deletions app/application/models/project.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ class Project extends Eloquent {
* @param string $url
* @return string
*/
public function to($url = '')
{
public function to($url = '') {
return URL::to('project/' . $this->id . (($url) ? '/'. $url : ''));
}

Expand All @@ -36,29 +35,24 @@ public function issues() {
* @param int $role_id
* @return void
*/
public function assign_user($user_id, $role_id = 0)
{
public function assign_user($user_id, $role_id = 0) {
Project\User::assign($user_id, $this->id, $role_id);
}

public function users()
{
public function users() {
return $this->has_many_and_belongs_to('\User', 'projects_users', 'project_id', 'user_id');
}

public function users_not_in()
{
public function users_not_in() {
$users = array();

foreach($this->users()->get(array('user_id')) as $user)
{
foreach($this->users()->get(array('user_id')) as $user) {
$users[] = $user->id;
}

$results = User::where('deleted', '=', 0);

if(count($users) > 0)
{
if(count($users) > 0) {
$results->where_not_in('id', $users);
}

Expand All @@ -71,10 +65,8 @@ public function users_not_in()
* @param int $user_id
* @return int
*/
public function count_assigned_issues($user_id = null)
{
if(is_null($user_id))
{
public function count_assigned_issues($user_id = null) {
if(is_null($user_id)) {
$user_id = \Auth::user()->id;
}
return \Tag::find(1)->issues()
Expand All @@ -83,15 +75,13 @@ public function count_assigned_issues($user_id = null)
->count();
}

public function count_open_issues()
{
public function count_open_issues() {
return \Tag::find(1)->issues()
->where('project_id', '=', $this->id)
->count();
}

public function count_closed_issues()
{
public function count_closed_issues() {
return \Tag::find(2)->issues()
->where('project_id', '=', $this->id)
->count();
Expand All @@ -102,13 +92,11 @@ public function count_closed_issues()
* @param int $activity_limit
* @return array
*/
public function activity($activity_limit)
{
public function activity($activity_limit) {
$users = $issues = $comments = $activity_type = array();

/* Load the activity types */
foreach(Activity::all() as $row)
{
foreach(Activity::all() as $row) {
$activity_type[$row->id] = $row;
}

Expand All @@ -118,38 +106,28 @@ public function activity($activity_limit)
->take($activity_limit)
->get();

if(!$project_activity)
{
if(!$project_activity) {
return null;
}

foreach($project_activity as $activity)
{
if(!isset($issues[$activity->item_id]))
{
foreach($project_activity as $activity) {
if(!isset($issues[$activity->item_id])) {
$issues[$activity->item_id] = Project\Issue::find($activity->item_id);
}

if(!isset($users[$activity->user_id]))
{
if(!isset($users[$activity->user_id])) {
$users[$activity->user_id] = User::find($activity->user_id);
}

if(!isset($comments[$activity->action_id]))
{
if(!isset($comments[$activity->action_id])) {
$comments[$activity->action_id] = Project\Issue\Comment::find($activity->action_id);
}

if($activity->type_id == 5)
{
if(!isset($users[$activity->action_id]))
{
if($activity->action_id > 0)
{
if($activity->type_id == 5) {
if(!isset($users[$activity->action_id])) {
if($activity->action_id > 0) {
$users[$activity->action_id] = User::find($activity->action_id);
}
else
{
} else {
$users[$activity->action_id] = array();
}
}
Expand All @@ -159,10 +137,8 @@ public function activity($activity_limit)
/* Loop through the projects and activity again, building the views for each activity */
$return = array();

foreach($project_activity as $row)
{
switch($row->type_id)
{
foreach($project_activity as $row) {
switch($row->type_id) {
case 2:
$return[] = View::make('activity/' . $activity_type[$row->type_id]->activity, array(
'issue' => $issues[$row->item_id],
Expand Down Expand Up @@ -237,8 +213,7 @@ public function activity($activity_limit)
*
* @return Project
*/
public static function current()
{
public static function current() {
return static::$current;
}

Expand All @@ -248,8 +223,7 @@ public static function current()
* @param int $id
* @return void
*/
public static function load_project($id)
{
public static function load_project($id) {
static::$current = static::find($id);
}

Expand All @@ -259,16 +233,14 @@ public static function load_project($id)
* @param array $input
* @return array
*/
public static function create_project($input)
{
public static function create_project($input) {
$rules = array(
'name' => 'required|max:250'
);

$validator = \Validator::make($input, $rules);

if($validator->fails())
{
if($validator->fails()) {
return array(
'success' => false,
'errors' => $validator->errors
Expand All @@ -285,10 +257,8 @@ public static function create_project($input)
$project->save();

/* Assign selected users to the project */
if(isset($input['user']) && count($input['user']) > 0)
{
foreach($input['user'] as $id)
{
if(isset($input['user']) && count($input['user']) > 0) {
foreach($input['user'] as $id) {
$project->assign_user($id);
}
}
Expand All @@ -306,16 +276,14 @@ public static function create_project($input)
* @param \Project $project
* @return array
*/
public static function update_project($input, $project)
{
public static function update_project($input, $project) {
$rules = array(
'name' => 'required|max:250'
);

$validator = \Validator::make($input, $rules);

if($validator->fails())
{
if($validator->fails()) {
return array(
'success' => false,
'errors' => $validator->errors
Expand Down Expand Up @@ -351,8 +319,7 @@ public static function update_weblnks($input, $project) {
* @param Project $project
* @return void
*/
public static function delete_project($project)
{
public static function delete_project($project) {
$id = $project->id;
$project->delete();

Expand Down
10 changes: 2 additions & 8 deletions app/application/models/project/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ public static function users_issues($user = null) {
* @return array
*/
public static function active_projects($all = false, $user = null) {
if(is_null($user)) {
$user = \Auth::user();
}
if(is_null($user)) { $user = \Auth::user(); }

if($all) {
if($user->permission('project-all')) {
Expand All @@ -152,12 +150,8 @@ public static function active_projects($all = false, $user = null) {
}

$projects = array();

foreach(static::with('project')->where('user_id', '=', $user->id)->get() as $row) {
if($row->project->status != 1) {
continue;
}

if($row->project->status != 1) { continue; }
$projects[] = $row->project;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
$valadd = trim(substr($activity->attributes['data'], $prem+1, ($pren-$prem)-1));
$numtag = ($valadd != '') ? $valadd : intval(trim(substr($activity->attributes['data'], $deux+1, ($deuy-$deux)-1))) * -1;
$tag_info = \DB::table('tags')->where('id', '=', abs($numtag))->get();
echo '<label style="background-color: '.$tag_info[0]->bgcolor.'; '.($tag_info[0]->ftcolor ? 'color: '.$tag_info[0]->ftcolor.'; ' : '').' padding: 5px 10px; border-radius: 8px;">'.$tag_info[0]->tag.'</label><b>';
echo ' ';
echo ($numtag > 0) ? '<span style="color: green;">'.__('tinyissue.tag_added').'</span>' : '<span style="color: red;">'.__('tinyissue.tag_removed').'</span>';
echo ' '.__('tinyissue.by').' '.$user->attributes["firstname"].' '.$user->attributes["lastname"].'</b></a> ';
echo ' &nbsp;&nbsp; '.date(Config::get('application.my_bugs_app.date_format'), strtotime($activity->attributes['updated_at'])).'';
if (count($tag_info) > 0) {
echo '<label style="background-color: '.$tag_info[0]->bgcolor.'; '.($tag_info[0]->ftcolor ? 'color: '.$tag_info[0]->ftcolor.'; ' : '').' padding: 5px 10px; border-radius: 8px;">'.$tag_info[0]->tag.'</label><b>';
echo ' ';
echo ($numtag > 0) ? '<span style="color: green;">'.__('tinyissue.tag_added').'</span>' : '<span style="color: red;">'.__('tinyissue.tag_removed').'</span>';
echo ' '.__('tinyissue.by').' '.$user->attributes["firstname"].' '.$user->attributes["lastname"].'</b></a> ';
echo ' &nbsp;&nbsp; '.date(Config::get('application.my_bugs_app.date_format'), strtotime($activity->attributes['updated_at'])).'';
}
}
?>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/application/views/project/sidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
asort($SansAccent);

foreach($SansAccent as $ind => $val) {
$selected = (substr($ind, strrpos($ind, "/")+1) == Project::current()->id) ? 'selected':'';
$selected = (substr($ind, strrpos($ind, "/")+1) == Project::current()->id) ? 'selected' : '';
echo '<option value="'.$ind.(($NbIssues[$ind] == 0) ? '' : '/issues?tag_id=1').'" '.$selected.'>'.$Proj[$ind].'</option>';
}
?>
Expand Down

0 comments on commit 6c7b9a7

Please sign in to comment.