I am using will paginate for pagination. I have total 11 pages currently. At footer it shows all the 11 pages no matter on what page the user is. How can I display max 10 pages at footer. So if user comes on page no 5 it will show 5 pages before and after. Not all at once.
You can use the inner_window and outer_window options to control how many page links are displayed. If you only want to show 5 pages on either side of the current page, your view would look like:
<%= will_paginate #objects, inner_window: 5, outer_window: 0 %>
Though because your current page is also included, you'll have to show an odd number (1 + N * 2), so I hope you're alright with 9 or 11.
If you really want to get into it, you'll notice there's also a renderer option that lets you pass a custom link rendering class. The renderer instance needs to response to prepare and to_html like the default renderer does.
Related
I currently have a working multipage report with repeating header / footer. I have implemented page count on footer successfully (eg: Page 1 of 20).
I need to change the header content on pages after the first page (adding "(Continued)" to title):
My Long list of Stuff
Item 1
Item 2
Page 1 of 20
My Long list of Stuff (continued)
Item 3
Item 4
Page 2 of 20
I can't seem to find any way to target only the pages after first. I have experimented with :nth-of-type. Using javascript after page loads to try and access counter.
let hiddenCounter = window.getComputedStyle(hiddenCounterEl, '::after').content;
I suspect getComputedStyle() not supported by PDF Reactor. Any thoughts on how to achieve this appreciated.
EDIT:
The repeating section described above is a part of a larger report so something like below wouldn't work because I wouldn't know the page to start from:
.showonsubqequent { display:none; }
#page :not(:first) {
.showonsubqequent { display:inline; }
}
You can use continuation markers to fulfill use-cases like this. We've introduced them with PDFreactor 11.
With the ::-ro-after-break pseudo-element, you can add generated content to elements after page breaks.
The respective style declarations could look like this:
ul::before {
content: "My Long list of Stuff";
}
ul::-ro-after-break {
content: "My Long list of Stuff (continued)";
}
Please refer to our manual for more information on continuation markers. https://www.pdfreactor.com/product/doc_html/index.html#ContinuationMarkers
While window.getComputedStyle() is supported by PDFreactor, the issue you were observing is a known issue (#8626) and has been fixed in PDFreactor 11.4.4. Prior to that version, only pseudo-element parameters without colons were supported.
Also, please note that nesting element selectors inside of page selectors is not supported by design. This is because applying styles to an element based on the page it is positioned on could change said position in the document.
I need to put profile pic and cover photo on left block in member index I have try every single method but useless
So any help please
Actually phpfox 4.7
Please admins don't close the post I really need help with this tutorial
Here is a screenshots
https://i.stack.imgur.com/TewzF.jpg
https://i.stack.imgur.com/yI0FG.jpg
Go to AdminCP - Appearance - Blocks - Add Block
Now Fill the form as below
Product = Core
Module = Profile
Title = Anything(wont display public)
Type = PHP Block File
Page = Member Home Page (core. index-member)
Component = header (for cover photo), logo (for logo)
Placement View Sample Layout = Block 1 (This will place the image on left block
I have an view that extends the current project view, where we add multiple tabs (notebook pages) to show information from other parts of a project.
One of these pages is an overview page that summarizes what is under the other tabs, and I'd like to link the headlines for each section directly to each displayed page. I've currently solved this by using the index of each tab and calling bootstrap's .tab('show') method on the link within the tab:
$(".overview-link").click(function (e) {
e.preventDefault();
var sel = '.nav-tabs a:eq(' + $(this).data('tab-index') + ')';
$(sel).tab('show');
});
This works since I've attached a data-tab-index="<int>" to each header link in my widget code, but it's brittle - if someone adds a tab later, the current indices will be broken. Earlier I relied on the anchor on each tab, but that broke as well (and would probably break if a new notebook page were inserted as well).
Triggering a web client redirect / form link directly works, but I want to show a specific page in the view:
this.do_action({
type: 'ir.actions.act_window',
res_model: 'my.model.name',
res_id: 'my.object.id',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'current'
});
Is there any way to link / redirect the web client directly to a specific notebook page tab through the do_action method or similar on FormWidget?
If I understood well you want to select the tab from the JavaScript (jQuery) FormWidget taking into account that the id could change if anybody install another module that adds another tab
Solution 0
You can add a class to the page in the xml form view. You can use the id of the element selected by this class name in order to call the right anchor and select the right tab item. This should happen when the page is completely loaded:
<page class="nb_page_to_select">
$('a[href=#' + $('.nb_page_to_select').attr('id') + ']').click()
NOTE: As you have said the following paragrah I assume that you know where to run this instruction. The solution I suggest is independent of the index.
This works since I've attached a data-tab-index="<int>" to each
header link in my widget code, but it's brittle - if someone adds a
tab later, the current indices will be broken. Earlier I relied on the
anchor on each tab, but that broke as well (and would probably break
if a new notebook page were inserted as well).
Solution 1
When the page is loaded you can get the tab list DOM object like this:
var tablist = $('ul[role="tablist"]')
And then you can click on the specifict tab, selecing by the text inside the anchor. So you don't depend on the tab index:
tablist.find('a:contains("Other Information")').click()
I think if you have two tabs with the same text does not make any sense, so this should be sufficient.
Solution 2
Even if you want to be more specific you can add a class to the notebook to make sure you are in the correct notebook
<notebook class="nt_to_change">
Now you can use one of this expressions in order to select the tab list
var tablist = $('div.nt_to_change ul.nav-tabs[role="tablist"]')
// or
var tablist = $('div.nt_to_change ul[role="tablist"]')
Solution 3
If the contains selector doesn't convince you because it should be equal you can do this as well to compare and filter
tablist.find('a').filter(function() {
return $.trim($(this).text()) === "Other Information";
}).click();
Where "Other Information" is the string of the notebook page
I didn't tried the solution I'm giving to you, but if it doesn't work at least may be it makes you come up with some idea.
There's a parameter for XML elements named autofocus (for buttons and fields is default_focus and takes 1 or 0 as value). If you add autofocus="autofocus" to a page in XML, this page will be the displayed one when you open the view.
So, you can try to add this through JavaScript, when the user clicks on the respective link -which honestly, I don't know how to achieve that by now-. But you can add a distinctive context parameter to each link in XML, for example context="{'page_to_display': 'page x'}". When you click on the link, I hope these context keys will arrive to your JS method.
If not, you can also modify the fields_view_get method (here I wrote how to do that: Odoo - Hide button for specific user) to check if you get the context you've added to your links and add the autofocus parameter to the respective page.
As you said:
This works since I've attached a data-tab-index="" to each header
link in my widget code, but it's brittle - if someone adds a tab
later, the current indices will be broken.
I assume that your app allow multi-user interaction in realtime, so you have to integrate somewhere in your code, an update part function.
This function will trig if something has changed and cleanout the data to rebuilt the index in order to avoid that the current indices will be broken.
I am using codeignietr pagination. I am facing a problem here.
The pagination numbers are coming in the page, but it is always fixed. Means if have total 8 pages, then I will click 5th page and it is going to the 5th page but from there if i click the next link it is not going to the 6th page, instead it is going to the 2nd page(the 1st page is always fixed or highlighted).
Currently If i click any page, only first page link only highlighting. I am expecting a code to highlight respective link on clicking on it.
Hello please set your $pagi_config['base_url'] correct.
Also please count correctly and set up $pagi_config['uri_segment'] correctly
in this particular case http://localhost/project_folder/articles //correctly set .htaccess + index.php removed is assumed
$pagi_config['base_url'] = base_url('articles/page'); //note that base_url() function is in url helper
$pagi_config['uri_segment'] = '3';
Please note that index() method in any controller does NOT accept any parameters! Anything written after controller name is considered as its method!
Also note that number generated by pagination library is not page number! It is offset!
Either use _remap(), or routes.php to make articles/<offset>, in routes case you still need extra method to take care of offset parameter.
On this part:
I am expecting a code to highlight respective link on clicking on it
Based on Codeigniter's docs, it should be something like this in your controller.
$config['num_tag_open'] = '<div class="current">';
$config['num_tag_close'] = '</div>';
You can than create a css style for .current and then whatever page you are on, the number will be styled.
A have a CI 2 project, and in a view I have 3 box, and I have to show them on different page, different routes. Approximately on 8 different route, so where suppose I declare them?
In the view in every function( 8 of them) or in the one view file and check for the current route if it's match the criteria. The problem, that not all of them should be shown, A box only in 5 view, B box in 4 and C box in 2 example.
I would declare it where it is most centralized. Checking to load the view in every function would mean that if you were to change your condition you'd have to update it in 8 different places!! That is not fun to maintain.
By checking in one view file everythin is more centralized. This might seem silly because your conditional can get big,
if ($is_route_1 || $is_route_2 || $is_route_4 || $is_route_5) {
// display the box
}
So if you wanted to display it on another page you can add it right here in the one view.