Skip to content

Commit

Permalink
Front office : Add edit button on video page (#319)
Browse files Browse the repository at this point in the history
---------
Co-authored-by: MacWarrior <[email protected]>
  • Loading branch information
clement-sanz authored Apr 18, 2024
1 parent 0292063 commit 6eedbc8
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 5 deletions.
2 changes: 2 additions & 0 deletions upload/admin_area/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
, 'enable_video_crew'
, 'enable_video_poster'
, 'enable_video_backdrop'
, 'enable_edit_button'
];

$config_booleans_to_refactor = [
Expand Down Expand Up @@ -406,6 +407,7 @@
'enable_video_crew',
'enable_video_poster',
'enable_video_backdrop',
'enable_edit_button',

'hide_empty_collection',
'display_video_comments',
Expand Down
10 changes: 9 additions & 1 deletion upload/admin_area/styles/cb_2014/layout/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,15 @@ <h2>Website Configurations</h2>
</div>
</div>
<hr/>

<div class="row">
<div class="col-md-4">
<label class="nowrap" for="enable_edit_button" title="{lang code='enable_edit_button'}">{lang code='enable_edit_button'}</label>
</div>
<div class="col-md-2 row-size">
<input value="yes" name="enable_edit_button" id="enable_edit_button" {if $row.enable_edit_button=='yes'}checked{/if} type="checkbox" class="ace ace-switch ace-switch-5"/>
<span class="lbl"></span>
</div>
</div>

</div>
<div class="col-md-4">
Expand Down
28 changes: 28 additions & 0 deletions upload/cb_install/sql/5.5.1/00014.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
SET @language_id_eng = (SELECT `language_id` FROM `{tbl_prefix}languages` WHERE language_code = 'en');
SET @language_id_fra = (SELECT `language_id` FROM `{tbl_prefix}languages` WHERE language_code = 'fr');

SET @language_key = 'edit_from_BO' COLLATE utf8mb4_unicode_520_ci;
INSERT IGNORE INTO `{tbl_prefix}languages_keys` (`language_key`) VALUES (@language_key);
SET @id_language_key = (SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` COLLATE utf8mb4_unicode_520_ci = @language_key);
INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES (@id_language_key, 'From admin area', @language_id_eng);
INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES (@id_language_key, 'Depuis l''administration', @language_id_fra);

SET @language_key = 'edit_from_FO' COLLATE utf8mb4_unicode_520_ci;
INSERT IGNORE INTO `{tbl_prefix}languages_keys` (`language_key`) VALUES (@language_key);
SET @id_language_key = (SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` COLLATE utf8mb4_unicode_520_ci = @language_key);
INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES (@id_language_key, 'From my account', @language_id_eng);
INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES (@id_language_key, 'Depuis mon compte', @language_id_fra);

SET @language_key = 'enable_edit_button' COLLATE utf8mb4_unicode_520_ci;
INSERT IGNORE INTO `{tbl_prefix}languages_keys` (`language_key`) VALUES (@language_key);
SET @id_language_key = (SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` COLLATE utf8mb4_unicode_520_ci = @language_key);
INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES (@id_language_key, 'Enable edit button', @language_id_eng);
INSERT IGNORE INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES (@id_language_key, 'Activer le bouton d''édition', @language_id_fra);

INSERT INTO `{tbl_prefix}config` (`name`, `value`) VALUES ('enable_edit_button','yes');
3 changes: 2 additions & 1 deletion upload/cb_install/sql/configs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ INSERT INTO `{tbl_prefix}config` (`configid`, `name`, `value`) VALUES
(NULL, 'enable_video_crew', 'yes'),
(NULL, 'enable_video_poster', 'no'),
(NULL, 'enable_video_backdrop', 'no'),
(NULL, 'tmdb_search', '10');
(NULL, 'tmdb_search', '10'),
(NULL, 'enable_edit_button', 'yes');

INSERT INTO `{tbl_prefix}video_resolution` (`title`, `ratio`, `enabled`, `width`, `height`, `video_bitrate`) VALUES
('240p', '16/9', 1, 428, 240, 240000),
Expand Down
6 changes: 6 additions & 0 deletions upload/cb_install/sql/language_ENG.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2233,3 +2233,9 @@ INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translatio
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'update_category'), 'Update category', @language_id);
INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'add_new_category'), 'Add new category', @language_id);
INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'edit_from_BO'), 'From admin area', @language_id);
INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'edit_from_FO'), 'From my account', @language_id);
INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'enable_edit_button'), 'Enable edit button', @language_id);
6 changes: 6 additions & 0 deletions upload/cb_install/sql/language_FRA.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1395,3 +1395,9 @@ INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translatio
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'update_category'), 'Mettre à jour la catégorie', @language_id);
INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'add_new_category'), 'Ajouter une nouvelle catégorie', @language_id);
INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'edit_from_BO'), 'Depuis l''administration', @language_id);
INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'edit_from_FO'), 'Depuis mon compte', @language_id);
INSERT INTO `{tbl_prefix}languages_translations` (`id_language_key`, `translation`, `language_id`)
VALUES ((SELECT id_language_key FROM `{tbl_prefix}languages_keys` WHERE `language_key` = 'enable_edit_button'), 'Activer le bouton d''édition', @language_id);
5 changes: 4 additions & 1 deletion upload/cb_install/sql/languages.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1116,4 +1116,7 @@ VALUES ('admin_setting'),
('select_as_default_x'),
('enable_x_field'),
('update_category'),
('add_new_category');
('add_new_category'),
('edit_from_BO'),
('edit_from_FO'),
('enable_edit_button');
5 changes: 3 additions & 2 deletions upload/changelog/551.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version":"5.5.1",
"revision":"13",
"revision":"14",
"status":"dev",
"detail":[
{
Expand All @@ -15,7 +15,8 @@
"description": [
"Refactor collections page"
,"Fix pagination on videos, collections & photos"
,"Fix comments display on photos collection (#91)"
,"Fix comments display on photos collection <i>(#91)</i>"
,"Add edit button on video page <i>(#319)</i>"
]
},
{
Expand Down
22 changes: 22 additions & 0 deletions upload/styles/cb_28/layout/watch_video.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,28 @@ <h2 class="user-title">
</button>
{/if}
{/if}

{if config('enable_edit_button') == 'yes'}
{if has_access('admin_access', true)}
{if user_id() && $video.userid == user_id()}
<div class="dropdown">
<button class="btn btn-success dropdown-toggle" type="button" id="dropdownEdit" data-toggle="dropdown" aria-expanded="true">
{lang code='edit'}
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dropdownEdit">
<li><a href="{$link_edit_bo}">{lang code='edit_from_BO'}</a></li>
<li><a href="{$link_edit_fo}">{lang code='edit_from_FO'}</a></li>
</ul>
</div>
{else}
<a class="btn btn-success" style="font-size: 14px; line-height: 14px;" href="{$link_edit_bo}">{lang code='edit'}</a>
{/if}
{elseif user_id() && $video.userid == user_id()}
<a class="btn btn-success" style=" font-size: 14px;line-height: 14px;" href="{$link_edit_fo}">{lang code='edit'}</a>
{/if}
{/if}

{if $Cbucket->configs.video_download==1 && $cbvid->downloadable($vdo)}
<div class="dropdown">
<button class="btn btn-success dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
Expand Down
4 changes: 4 additions & 0 deletions upload/watch_video.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
array_val_assign($assign_arry);
template_files('watch_video.html');

//link edit
assign('link_edit_bo', DirPath::get('admin_area',true) . 'edit_video.php?video=' . $vdo['videoid']);
assign('link_edit_fo', '/edit_video.php?vid=' . $vdo['videoid']);

if(in_dev()){
$min_suffixe = '';
} else {
Expand Down

0 comments on commit 6eedbc8

Please sign in to comment.