Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix group media paga issue #2038

Merged
merged 4 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 24 additions & 12 deletions app/assets/css/rtmedia.css
Original file line number Diff line number Diff line change
Expand Up @@ -2912,7 +2912,7 @@ h2.rtm-gallery-title {
}
.rtm-media-options .dashicons {
font-size: inherit;
line-height: 1.4;
line-height: 1.2;
}

#buddypress .media_search.media_search .search_by {
Expand Down Expand Up @@ -2987,9 +2987,14 @@ h2.rtm-gallery-title {
float: right;
border: 1px solid #ccc;
margin-left: 5px;
padding: 3px 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.media_search.media_search .media_search_input {
.media_search.media_search input.media_search_input {
width: 200px;
outline: 0;
max-width: 200px;
Expand Down Expand Up @@ -3019,19 +3024,26 @@ h2.rtm-gallery-title {
height: 15px;
top: 24%;
}
.media_search.media_search .search_option {
.media_search.media_search #media_search_remove, .media_search.media_search #media_search, .media_search.media_search .search_option {
padding: 0;
background: transparent;
color: #000;
margin-bottom: 0;
line-height: 1;
margin: 0;
border: none;
line-height: 1.2;
border-radius: 0;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.media_search.media_search .media_search_remove.search_option {
display: none;
.media_search.media_search #media_search {
padding: 0 5px;
-ms-flex-item-align: stretch;
align-self: stretch;
}
.media_search.media_search .media_search_remove.search_option i {
margin-top: 4px;
.media_search.media_search #media_search_remove {
display: none;
}
.media_search.media_search .search_by {
background: transparent;
Expand Down
2 changes: 1 addition & 1 deletion app/assets/css/rtmedia.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/css/rtmedia.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/assets/css/rtmedia.min.css.map

Large diffs are not rendered by default.

29 changes: 16 additions & 13 deletions app/assets/css/sass/_media-tab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ h2.rtm-gallery-title {

.dashicons {
font-size: inherit;
line-height: 1.4;
line-height: 1.2;
}
}

Expand Down Expand Up @@ -313,9 +313,10 @@ h2.rtm-gallery-title {
float: right;
border: 1px solid #ccc;
margin-left: 5px;
padding: 3px 0;
display: flex;
align-items: center;

.media_search_input {
input.media_search_input {
width: 200px;
outline: 0;
max-width: 200px;
Expand Down Expand Up @@ -348,21 +349,23 @@ h2.rtm-gallery-title {
}
}

.search_option {
#media_search_remove, #media_search, .search_option {
padding: 0;
background: transparent;
color: #000;
margin-bottom: 0;
line-height: 1;
margin: 0;
border: none;
line-height: 1.2;
border-radius: 0;
display: flex;
align-items: center;
}

.media_search_remove.search_option {
display: none;
#media_search {
padding: 0 5px;
align-self: stretch;
}

i {
margin-top: 4px;
}
#media_search_remove {
display: none;
}

.search_by {
Expand Down
57 changes: 37 additions & 20 deletions app/assets/js/rtMedia.backbone.js
Original file line number Diff line number Diff line change
Expand Up @@ -1432,7 +1432,12 @@ jQuery( document ).ready( function( $ ) {
* By: Yahil
*/
if ( '' === jQuery( '#whats-new' ).val().trim() ) {
if ( rtmedia_activity_text_with_attachment != 'disable' ) {
if ( rtmedia_activity_text_with_attachment == 'disable' ) {
if ( 'legacy' === bp_template_pack ) {
$('#whats-new').css('color', 'transparent');
$('#whats-new').val(' ');
}
} else {
jQuery('#whats-new-form').prepend('<div id="message" class="error bp-ajax-message" style="display: block;"><p> ' + rtmedia_empty_activity_msg + ' </p></div>')
jQuery( '#whats-new' ).removeAttr( 'disabled' );
return false;
Expand Down Expand Up @@ -1532,36 +1537,36 @@ jQuery( document ).ready( function( $ ) {
}
} );

var object = '';
var object = 'profile';
var item_id = 0;

if ( 'legacy' === bp_template_pack ) {
if ( jQuery( '#whats-new-post-in' ).length ) {
item_id = jQuery( '#whats-new-post-in' ).val();
} else if ( jQuery( '.groups-header' ).length ) {
item_id = jQuery( '.groups-header' ).attr( 'data-bp-item-id' );
if ( jQuery( '#whats-new-post-in' ).length > 0 ) {
item_id = jQuery('#whats-new-post-in').val();
}

if ( item_id > 0 ) {
object = 'group';
} else {
object = 'profile';
/* Set object for non-profile posts */
if ( item_id > 0 && jQuery('#whats-new-post-object').length > 0 ) {
object = jQuery('#whats-new-post-object').val();
}
} else {
var whatsNewPostIn = jQuery( '#whats-new-post-in' );
if ( whatsNewPostIn.length ) {
object = whatsNewPostIn.val();
item_id = 0;
} else {
object = 'profile';
if ( 'undefined' !== typeof BP_Nouveau?.activity?.params?.object ) {
object = BP_Nouveau.activity.params.object;
}

var contextData = jQuery( '#whats-new-post-in-box-items li.bp-activity-object.selected input[type="hidden"]' );
if ( contextData.length ) {
item_id = contextData.val();
if ( 'undefined' !== typeof BP_Nouveau?.activity?.params?.item_id ) {
item_id = BP_Nouveau.activity.params.item_id;
} else if ( ( 'profile' === object || 'user' === object ) && 'undefined' !== typeof BP_Nouveau?.activity?.params?.user_id ) {
item_id = BP_Nouveau.activity.params.user_id;
}
}

if ( 'groups' === object ) {
object = 'group';
} else if ( 'user' === object ) {
object = 'profile';
}

up.settings.multipart_params.context = object;
up.settings.multipart_params.context_id = item_id;
up.settings.multipart_params.title = files.title;
Expand All @@ -1585,6 +1590,13 @@ jQuery( document ).ready( function( $ ) {
* Blank error display issue resolved
*/
if ( bp_template_pack && 'legacy' !== bp_template_pack ) {

if ( 'legacy' === bp_template_pack && 'disable' === rtmedia_activity_text_with_attachment && '' === jQuery.trim( jQuery( '#whats-new' ).val() ) ) {
let textarea = jQuery( '#whats-new' );
textarea.css( 'color', 'transparent' );
textarea.val( ' ' );
}

jQuery( '#whats-new-form' ).submit();
} else {
jQuery( '#aw-whats-new-submit' ).click();
Expand Down Expand Up @@ -1682,7 +1694,12 @@ jQuery( document ).ready( function( $ ) {
* By: Yahil
*/

if ( rtmedia_activity_text_with_attachment != 'disable') {
if ( rtmedia_activity_text_with_attachment == 'disable') {
if ( 'legacy' === bp_template_pack ) {
$( '#whats-new' ).css( 'color', 'transparent' );
$( '#whats-new' ).val( '&nbsp;' );
}
} else {
jQuery('#whats-new-form').prepend('<div id="message" class="error bp-ajax-message" style="display: block;"><p> ' + rtmedia_empty_activity_msg + ' </p></div>')
jQuery( '#whats-new' ).removeAttr( 'disabled' );
return false;
Expand Down