Anonymous Segment.com tracking. Closes #91.

This commit is contained in:
James Brooks
2015-01-23 17:24:34 +00:00
committed by Joseph Cohen
parent a63c65a6c3
commit 5c391cc888
23 changed files with 523 additions and 8 deletions

View File

@@ -109,6 +109,11 @@ class DashComponentController extends Controller
$component->update($_component);
if (! $component->isValid()) {
segment_track('Dashboard', [
'event' => 'Edit Component',
'success' => false,
]);
return Redirect::back()->withInput(Binput::all())
->with('title', sprintf(
'<strong>%s</strong> %s',
@@ -118,6 +123,11 @@ class DashComponentController extends Controller
->with('errors', $component->getErrors());
}
segment_track('Dashboard', [
'event' => 'Edit Component',
'success' => true,
]);
// The component was added successfully, so now let's deal with the tags.
$tags = preg_split('/ ?, ?/', $tags);
@@ -168,6 +178,11 @@ class DashComponentController extends Controller
$component = Component::create($_component);
if (! $component->isValid()) {
segment_track('Dashboard', [
'event' => 'Created Component',
'success' => false,
]);
return Redirect::back()->withInput(Binput::all())
->with('title', sprintf(
'<strong>%s</strong> %s',
@@ -177,6 +192,11 @@ class DashComponentController extends Controller
->with('errors', $component->getErrors());
}
segment_track('Dashboard', [
'event' => 'Created Component',
'success' => true,
]);
// The component was added successfully, so now let's deal with the tags.
$tags = preg_split('/ ?, ?/', $tags);
@@ -207,6 +227,10 @@ class DashComponentController extends Controller
*/
public function deleteComponentAction(Component $component)
{
segment_track('Dashboard', [
'event' => 'Deleted Component',
]);
$component->delete();
return Redirect::back();
@@ -221,6 +245,10 @@ class DashComponentController extends Controller
*/
public function deleteComponentGroupAction(ComponentGroup $group)
{
segment_track('Dashboard', [
'event' => 'Deleted Component Group',
]);
$group->delete();
return Redirect::back();
@@ -248,6 +276,11 @@ class DashComponentController extends Controller
$group = ComponentGroup::create(Binput::get('group'));
if (! $group->isValid()) {
segment_track('Dashboard', [
'event' => 'Created Component Group',
'success' => false,
]);
return Redirect::back()->withInput(Binput::all())
->with('title', sprintf(
'<strong>%s</strong> %s',
@@ -257,6 +290,11 @@ class DashComponentController extends Controller
->with('errors', $group->getErrors());
}
segment_track('Dashboard', [
'event' => 'Created Component Group',
'success' => true,
]);
$successMsg = sprintf(
'<strong>%s</strong> %s',
trans('dashboard.notifications.awesome'),