From d0545b6bd6edc38bf06604900b1e20a60e7c8583 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 10 Apr 2016 21:48:11 +0200 Subject: [PATCH] Add migration --- .../Version20160410190541.php | 26 +++++++++++++++++++ .../CoreBundle/Command/InstallCommand.php | 5 ++++ .../CoreBundle/Controller/EntryController.php | 5 ++-- .../DataFixtures/ORM/LoadSettingData.php | 5 ++++ .../views/themes/baggy/Entry/entry.html.twig | 3 +++ .../themes/material/Entry/entry.html.twig | 2 +- 6 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 app/DoctrineMigrations/Version20160410190541.php diff --git a/app/DoctrineMigrations/Version20160410190541.php b/app/DoctrineMigrations/Version20160410190541.php new file mode 100644 index 00000000..b30a898c --- /dev/null +++ b/app/DoctrineMigrations/Version20160410190541.php @@ -0,0 +1,26 @@ +addSql('ALTER TABLE wallabag_entry ADD uuid LONGTEXT DEFAULT NULL'); + $this->addSql('UPDATE wallabag_entry SET uuid = uuid()'); + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $this->addSql('ALTER TABLE `wallabag_entry` DROP uuid'); + } +} diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index e134ced5..143def4f 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -241,6 +241,11 @@ class InstallCommand extends ContainerAwareCommand $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute(); $settings = [ + [ + 'name' => 'share_public', + 'value' => '1', + 'section' => 'entry', + ], [ 'name' => 'carrot', 'value' => '1', diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index a78dd00c..e3b4b1eb 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -451,10 +451,9 @@ class EntryController extends Controller private function checkIfEntryAlreadyExists(Entry $entry) { return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); - } - /* + /** * Share entry content. * * @param Entry $entry @@ -463,7 +462,7 @@ class EntryController extends Controller * * @return \Symfony\Component\HttpFoundation\Response */ - public function shareEntry(Entry $entry) + public function shareEntryAction(Entry $entry) { return $this->render( '@WallabagCore/themes/share.html.twig', diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php index 09058796..b4309304 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php @@ -15,6 +15,11 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface public function load(ObjectManager $manager) { $settings = [ + [ + 'name' => 'share_public', + 'value' => '1', + 'section' => 'entry', + ], [ 'name' => 'carrot', 'value' => '1', diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig index ce47a677..61b871f0 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig @@ -17,6 +17,9 @@
  • {{ 'entry.view.left_menu.set_as_starred'|trans }}
  • {{ 'entry.view.left_menu.add_a_tag'|trans }}
  • {{ 'entry.view.left_menu.delete'|trans }}
  • + {% if craue_setting('share_public') %} +
  • public
  • + {% endif %} {% if craue_setting('share_twitter') %}
  • {% endif %} {% if craue_setting('share_mail') %}
  • {% endif %} {% if craue_setting('share_shaarli') %}
  • shaarli
  • {% endif %} diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig index b634dd40..d05bdd08 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig @@ -99,7 +99,7 @@