1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Updated views for permissions and added notifications. Fixes #2 and #7

This commit is contained in:
Dan Brown
2015-08-29 16:00:19 +01:00
parent ae95d0a239
commit f37a886205
9 changed files with 141 additions and 14 deletions

View File

@ -3,6 +3,7 @@
use Illuminate\Support\Facades\Auth;
use Oxbow\Activity;
use Oxbow\Entity;
use Session;
class ActivityService
{
@ -35,6 +36,7 @@ class ActivityService
$this->activity->extra = $extra;
}
$entity->activity()->save($this->activity);
$this->setNotification($activityKey);
}
/**
@ -52,8 +54,10 @@ class ActivityService
$this->activity->extra = $extra;
}
$this->activity->save();
$this->setNotification($activityKey);
}
/**
* Removes the entity attachment from each of its activities
* and instead uses the 'extra' field with the entities name.
@ -84,4 +88,17 @@ class ActivityService
->skip($count*$page)->take($count)->get();
}
/**
* Flashes a notification message to the session if an appropriate message is available.
* @param $activityKey
*/
protected function setNotification($activityKey)
{
$notificationTextKey = 'activities.' . $activityKey . '_notification';
if (trans()->has($notificationTextKey)) {
$message = trans($notificationTextKey);
Session::flash('success', $message);
}
}
}