Skip to content
This repository

ModuleBuilder fixes #483

Merged
merged 2 commits into from almost 2 years ago

3 participants

Mat Whitney Lonnie Ezell Sean Downey
Mat Whitney
Collaborator
  • view_default: remove / before site_url in delete button
  • view_index: fix colspan on table footer when using soft deletes, created, or modified fields
Mat Whitney ModuleBuilder fixes
- db migration: add prefix to table name in create_table and drop_table
statements
- view_default: remove / before site_url in delete button
- view_index: fix colspan on table footer when using soft deletes,
created, or modified fields
94f1d93
Lonnie Ezell
Owner

I haven't looked at the rest of it, yet, but you don't need to manually add the prefix within dbforge calls. Just like the db functions, it will use the database config's db_prefix value and append it to it.

Mat Whitney
Collaborator

I've removed the create/drop table changes. The rest should be fairly straight-forward, the view_default file was generating an href like /http://..., and the view_index file is most obvious when using all three fields (soft delete, created, and modified), since the table footer is 2 columns short of the full table width.

Sean Downey seandowney merged commit 420781b into from June 09, 2012
Sean Downey seandowney closed this June 09, 2012
Sean Downey
Owner

Thanks @mwhitneysdsu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Jun 08, 2012
Mat Whitney ModuleBuilder fixes
- db migration: add prefix to table name in create_table and drop_table
statements
- view_default: remove / before site_url in delete button
- view_index: fix colspan on table footer when using soft deletes,
created, or modified fields
94f1d93
Mat Whitney revert addition of prefix to create/drop statements 822b804
This page is out of date. Refresh to see the latest.
2  bonfire/application/core_modules/modulebuilder/views/files/view_default.php 100755 → 100644
@@ -212,7 +212,7 @@
212 212
     $delete = PHP_EOL . '
213 213
     <?php if ($this->auth->has_permission(\''.$delete_permission.'\')) : ?>
214 214
 
215  
-            or <a class="btn btn-danger" id="delete-me" href="/<?php echo site_url(SITE_AREA .\'/'.$controller_name.'/'.$module_name_lower.'/delete/\'. $id);?>" onclick="return confirm(\'<?php echo lang(\''.$module_name_lower.'_delete_confirm\'); ?>\')" name="delete-me">
  215
+            or <a class="btn btn-danger" id="delete-me" href="<?php echo site_url(SITE_AREA .\'/'.$controller_name.'/'.$module_name_lower.'/delete/\'. $id);?>" onclick="return confirm(\'<?php echo lang(\''.$module_name_lower.'_delete_confirm\'); ?>\')" name="delete-me">
216 216
             <i class="icon-trash icon-white">&nbsp;</i>&nbsp;<?php echo lang(\''.$module_name_lower.'_delete_record\'); ?>
217 217
             </a>
218 218
 
11  bonfire/application/core_modules/modulebuilder/views/files/view_index.php 100755 → 100644
@@ -88,7 +88,7 @@
88 88
 	{
89 89
 		continue; 	// move onto next iteration of the loop
90 90
 	}
91  
-      
  91
+
92 92
 	if($db_required == 'new' && $table_as_field_prefix === TRUE)
93 93
 	{
94 94
 		$field_name = $module_name_lower . '_' . set_value("view_field_name$counter");
@@ -97,7 +97,7 @@
97 97
 	{
98 98
 		$field_name = set_value("view_field_name$counter");
99 99
 	}
100  
-	else 
  100
+	else
101 101
 	{
102 102
 		$field_name = set_value("view_field_name$counter");
103 103
 	}
@@ -108,7 +108,7 @@
108 108
 				<td><?php echo anchor(SITE_AREA .'/".$controller_name."/".$module_name_lower."/edit/'. \$record->".$primary_key_field.", {$pencil_icon} \$record->".$field_name.") ?></td>
109 109
 				<?php else: ?>
110 110
 				<td><?php echo \$record->".$field_name." ?></td>
111  
-				<?php endif; ?>		
  111
+				<?php endif; ?>
112 112
 			";
113 113
 	}
114 114
 	else {
@@ -120,21 +120,24 @@
120 120
 {
121 121
 	$table_records .= '
122 122
 				<td><?php echo $record->deleted > 0 ? lang(\''.$module_name_lower.'_true\') : lang(\''.$module_name_lower.'_false\')?></td>';
  123
+	$field_total++;
123 124
 }
124 125
 if ($use_created == 'true')
125 126
 {
126 127
 	$table_records .= '
127 128
 				<td><?php echo $record->'.set_value("created_field").'?></td>';
  129
+	$field_total++;
128 130
 }
129 131
 if ($use_modified == 'true')
130 132
 {
131 133
 	$table_records .= '
132 134
 				<td><?php echo $record->'.set_value("modified_field").'?></td>';
  135
+	$field_total++;
133 136
 }
134 137
 
135 138
 
136 139
 
137  
-$view = str_replace('{cols_total}', $field_total + 2 , $view);
  140
+$view = str_replace('{cols_total}', $field_total + 1 , $view);
138 141
 $view = str_replace('{table_header}', $headers, $view);
139 142
 $view = str_replace('{table_records}', $table_records, $view);
140 143
 $view = str_replace('{delete_permission}', preg_replace("/[ -]/", "_", ucfirst($module_name)).'.'.ucfirst($controller_name).'.Delete', $view);
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.