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

new theme: "minimal" #408

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
36d3f2f
add theme option
JonathanReeve May 23, 2014
a97e296
remove tabs in minimal theme
JonathanReeve May 23, 2014
69fd625
add skeleton of minimal theme for docs loop
JonathanReeve May 23, 2014
affafc3
add tags etc
JonathanReeve May 27, 2014
87b57af
better classes for better css selecting
JonathanReeve May 27, 2014
f0b3ca4
styles for minimal theme
JonathanReeve May 27, 2014
a81430f
enable sourcemaps for easy debugging via web inspector
JonathanReeve May 27, 2014
447a554
style tweaks
JonathanReeve May 27, 2014
f275765
add doc icons
JonathanReeve May 27, 2014
26349f8
more style tweaks
JonathanReeve May 27, 2014
765eb2a
clean up debug messages
JonathanReeve May 27, 2014
36ff275
remove puzzling 50% declaration on titles, fixes #5
JonathanReeve May 27, 2014
4804582
Merge branch '1.7.x'
JonathanReeve May 28, 2014
66d9604
don't underline icon, fixes #3
JonathanReeve May 28, 2014
57962b9
remove 'show' from activity filter labels
JonathanReeve Jul 18, 2014
1414472
remove 'show' from activity filter labels
JonathanReeve Jul 18, 2014
2ce945a
attempted merge of minimal theme into 1.8
JonathanReeve Aug 11, 2014
34103a8
fixed merge problem
JonathanReeve Aug 11, 2014
00a4eae
show existing attachments when attachments are disabled
JonathanReeve Aug 13, 2014
dbbc406
Revert "show existing attachments when attachments are disabled"
JonathanReeve Aug 13, 2014
5f917d1
minor style fixes
JonathanReeve Nov 3, 2014
64337da
add sourcemap
JonathanReeve Nov 3, 2014
477bbc2
Merge branch 'develop'
JonathanReeve Nov 3, 2014
7ca73af
option to enable/disable comments on docs
JonathanReeve Feb 11, 2015
3e2d9af
remove debug logging
JonathanReeve Feb 12, 2015
ea62fa9
option to enable/disable comments on docs
JonathanReeve Feb 11, 2015
8bd5926
remove debug logging
JonathanReeve Feb 12, 2015
9e1eb6e
Merge pull request #12 from mlaa/hotfix-comments-option
JonathanReeve Feb 12, 2015
301b6cb
re-enable counts on Docs tab, fixes #1
JonathanReeve Feb 25, 2015
d8b12c8
better updating of docs count for #1
JonathanReeve Feb 25, 2015
59405cd
cleaning up
JonathanReeve Feb 25, 2015
71eb407
support for updating doc count on first run
JonathanReeve Feb 26, 2015
a165922
re-enable counts on Docs tab, fixes #1
JonathanReeve Feb 25, 2015
385fc4b
better updating of docs count for #1
JonathanReeve Feb 25, 2015
3dc1083
cleaning up
JonathanReeve Feb 25, 2015
8b56607
support for updating doc count on first run
JonathanReeve Feb 26, 2015
ff96b21
Merge pull request #13 from mlaa/hotfix-doc-counts
JonathanReeve Feb 27, 2015
b4ac351
Merge branch 'develop'
JonathanReeve May 1, 2015
ae2a2f3
Add composer.json.
chriszarate Jun 16, 2015
c0faad0
Oops
boonebgorges Nov 10, 2014
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
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "mlaa/buddypress-docs",
"type": "wordpress-plugin",
"require": {
"php": ">=5.3.0",
"composer/installers": "~1.0"
}
}
3 changes: 3 additions & 0 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass includes/sass scss && rm -rf sass && mv scss sass

# Enable sourcemaps!
sass_options = {:sourcemap => true}
6 changes: 3 additions & 3 deletions includes/activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,9 @@ function bp_docs_prefetch_activity_object_data( $activities ) {
function bp_docs_activity_filter_options() {
?>

<option value="bp_doc_created"><?php _e( 'Show New Docs', 'bp-docs' ); ?></option>
<option value="bp_doc_edited"><?php _e( 'Show Doc Edits', 'bp-docs' ); ?></option>
<option value="bp_doc_comment"><?php _e( 'Show Doc Comments', 'bp-docs' ); ?></option>
<option value="bp_doc_created"><?php _e( 'New Docs', 'bp-docs' ); ?></option>
<option value="bp_doc_edited"><?php _e( 'Doc Edits', 'bp-docs' ); ?></option>
<option value="bp_doc_comment"><?php _e( 'Doc Comments', 'bp-docs' ); ?></option>

<?php
}
Expand Down
53 changes: 53 additions & 0 deletions includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ public function setup_settings() {
);
register_setting( 'bp-docs-settings', 'bp-docs-excerpt-length', 'absint' );

// General - Enable Comments
add_settings_field(
'bp-docs-enable-comments',
__( 'Enable Comments', 'bp-docs' ),
array( $this, 'enable_comments_setting_markup' ),
'bp-docs-settings',
'bp-docs-general'
);
register_setting( 'bp-docs-settings', 'bp-docs-enable-comments', 'absint' );

// Users
add_settings_section(
'bp-docs-users',
Expand Down Expand Up @@ -134,12 +144,31 @@ public function setup_settings() {
'bp-docs-attachments'
);
register_setting( 'bp-docs-settings', 'bp-docs-enable-attachments' );

// Appearance
add_settings_section(
'bp-docs-appearance',
__( 'Appearance', 'bp-docs' ),
array( $this, 'appearance_section' ),
'bp-docs-settings'
);

// Appearance - Theme
add_settings_field(
'bp-docs-theme',
__( 'Theme', 'bp-docs' ),
array( $this, 'theme_setting_markup' ),
'bp-docs-settings',
'bp-docs-appearance'
);
register_setting( 'bp-docs-settings', 'bp-docs-theme' );
}

public function general_section() {}
public function users_section() {}
public function groups_section() {}
public function attachments_section() {}
public function appearance_section() {}

public function slug_setting_markup() {
global $bp;
Expand All @@ -164,6 +193,17 @@ public function excerpt_length_setting_markup() {
<?php
}

public function enable_comments_setting_markup() {

$comments_enabled = bp_docs_get_setting_comments_enabled();

?>
<input name="bp-docs-enable-comments" id="bp-docs-enable-comments" type="checkbox" value="1" <?php checked( $comments_enabled ); ?> />
<p class="description"><?php _e( "Allow people to post comments on new docs? This will override your WordPress comments setting.", 'bp-docs' ) ?></p>

<?php
}

public function group_tab_name_setting_markup() {
$name = bp_docs_get_group_tab_name();

Expand Down Expand Up @@ -197,6 +237,19 @@ public function enable_attachments_setting_markup() {
<?php
}

public function theme_setting_markup() {
$theme = bp_docs_get_theme();

?>
<select name="bp-docs-theme" id="bp-docs-theme">
<option value="default" <?php selected( $theme, 'default' ) ?>><?php _e( 'Default', 'bp-docs' ) ?></option>
<option value="minimal" <?php selected( $theme, 'minimal' ) ?>><?php _e( 'Minimal', 'bp-docs' ) ?></option>
</select>
<p class="description"><?php _e( "Change the look and feel of Buddypress Docs.", 'bp-docs' ) ?></p>

<?php
}

function replace_recent_comments_dashboard_widget() {
global $wp_meta_boxes;

Expand Down
4 changes: 2 additions & 2 deletions includes/component.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,10 @@ function set_current_view( $item_type = false ) {
function setup_nav( $main_nav = array(), $sub_nav = array() ) {

$main_nav = array(
'name' => bp_docs_get_user_tab_name(),
//'name' => bp_docs_get_user_tab_name(),

// Disabled count for now. See https://github.com/boonebgorges/buddypress-docs/issues/261
//'name' => sprintf( __( 'Docs <span>%d</span>', 'bp-docs' ), bp_docs_get_doc_count( bp_displayed_user_id(), 'user' ) ),
'name' => sprintf( __( 'Docs <span>%d</span>', 'bp-docs' ), bp_docs_get_doc_count( bp_displayed_user_id(), 'user' ) ),
'slug' => bp_docs_get_docs_slug(),
'position' => 80,
'screen_function' => array( &$this, 'template_loader' ),
Expand Down
2 changes: 1 addition & 1 deletion includes/css/edit.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ a.delete-doc-button {
}

form.standard-form input[type="text"]#doc-title {
width: 98%;
width: 100%;
}

#buddypress .standard-form label#content-label,
Expand Down
2 changes: 2 additions & 0 deletions includes/css/ie.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions includes/css/print.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion includes/css/screen.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions includes/css/screen.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -794,3 +794,9 @@ function bp_docs_revisions_to_keep( $num, $post ) {
return intval( $num );
}
add_filter( 'wp_revisions_to_keep', 'bp_docs_revisions_to_keep', 10, 2 );

/* What's the current Buddypress Docs theme? */
function bp_docs_get_theme() {
$theme = get_option( 'bp-docs-theme', 'default' );
return apply_filters( 'bp_docs_theme', $theme );
}
49 changes: 35 additions & 14 deletions includes/integration-groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ function __construct() {
add_filter( 'bp_docs_hide_sitewide', array( $this, 'hide_sitewide' ), 10, 5 );

// These functions are used to keep the group Doc count up to date
add_filter( 'bp_docs_doc_saved', array( $this, 'update_doc_count' ) );
add_filter( 'bp_docs_doc_deleted', array( $this, 'update_doc_count' ) );
add_action( 'bp_docs_doc_saved', array( $this, 'update_doc_count' ) );
add_action( 'bp_docs_doc_deleted', array( $this, 'update_doc_count' ) );

// On non-group Doc directories, add a Groups column
add_filter( 'bp_docs_loop_additional_th', array( $this, 'groups_th' ), 5 );
Expand All @@ -74,7 +74,7 @@ function __construct() {
// Sneak into the nav before it's rendered to insert the group Doc count. Hooking
// to bp_actions because of the craptastic nature of the BP_Group_Extension loader
// @todo Temporarily disabled
//add_action( 'bp_actions', array( $this, 'show_doc_count_in_tab' ), 9 );
add_action( 'bp_actions', array( $this, 'show_doc_count_in_tab' ), 9 );

// Prettify the page title
add_filter( 'bp_page_title', array( $this, 'page_title' ) );
Expand Down Expand Up @@ -681,15 +681,34 @@ function hide_sitewide( $hide_sitewide, $comment, $doc, $item, $component ) {
* @package BuddyPress Docs
* @since 1.0.8
*/
function update_doc_count() {
function update_doc_count( $group_id = 0 ) {
global $bp;

// If this is not a group Doc, skip it
if ( !bp_is_group() )
return;

// Get a fresh doc count for the group
bp_docs_update_doc_count( bp_get_current_group_id(), 'group' );
if ( array_key_exists( 'delete', $_GET ) ) {
// We're deleting a doc. In the deleting context,
// we get useful information from `bp_docs_get_associated_group_id()`.
$doc_id = is_singular() ? get_the_ID() : 0;
$group_id = bp_docs_get_associated_group_id( $doc_id );
} else if ( array_key_exists( 'group', $_GET ) ) {
// We're creating a doc. In the doc creation context,
// we don't get anything useful from `bp_docs_get_associated_group_id()`,
// so we have to figure out what group we're in by looking at the
// $_GET variable that's passed during this step.
$group_id = BP_Groups_Group::group_exists( $_GET['group'] );
} else if ( 0 !== $group_id ) {
// If $group_id is passed through this function,
// that means it's probably being called via show_doc_count_in_tab().
// This means that the doc count is probably '', which means this is probably
// the first time this function has been run for this group.
// Nothing to do here. Pass along through.
} else {
// If we're not creating or deleting a document, or updating for the first time,
// get outta here!
return;
}

// Update the doc count for the group, since it has now changed.
bp_docs_update_doc_count( $group_id, 'group' );
}

/**
Expand Down Expand Up @@ -836,12 +855,14 @@ function show_doc_count_in_tab() {
if ( !empty( $bp->bp_options_nav[$group_slug] ) && !empty( $bp->bp_options_nav[$group_slug][ $docs_slug ] ) ) {
$current_tab_name = $bp->bp_options_nav[$group_slug][ $docs_slug ]['name'];

$doc_count = groups_get_groupmeta( $bp->groups->current_group->id, 'bp-docs-count' );
$group_id = $bp->groups->current_group->id;

$doc_count = groups_get_groupmeta( $group_id, 'bp-docs-count' );

// For backward compatibility
if ( '' === $doc_count ) {
BP_Docs_Groups_Integration::update_doc_count();
$doc_count = groups_get_groupmeta( $bp->groups->current_group->id, 'bp-docs-count' );
BP_Docs_Groups_Integration::update_doc_count( $group_id );
$doc_count = groups_get_groupmeta( $group_id, 'bp-docs-count' );
}

$bp->bp_options_nav[$group_slug][ $docs_slug ]['name'] = sprintf( __( '%s <span>%d</span>', 'bp-docs' ), $current_tab_name, $doc_count );
Expand Down Expand Up @@ -1204,7 +1225,7 @@ function enable_nav_item() {
* @package BuddyPress Docs
* @since 1.0-beta
*/
function display() {
function display( $group_id = null ) {
global $bp;

// Docs are stored on the root blog
Expand Down
3 changes: 2 additions & 1 deletion includes/query-builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ function save( $args = false ) {
'post_title' => $_POST['doc']['title'],
'post_name' => isset( $_POST['doc']['permalink'] ) ? sanitize_title( $_POST['doc']['permalink'] ) : sanitize_title( $_POST['doc']['title'] ),
'post_content' => sanitize_post_field( 'post_content', $doc_content, 0, 'db' ),
'post_status' => 'publish'
'post_status' => 'publish',
'comment_status' => ( ( bp_docs_get_setting_comments_enabled() ) ? 'open' : 'closed' ),
);

$r = wp_parse_args( $args, $defaults );
Expand Down
Loading